add contract
This commit is contained in:
parent
fd4d38ab44
commit
df14401b28
30
backend/controllers/TestController.php
Normal file
30
backend/controllers/TestController.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\controllers;
|
||||||
|
|
||||||
|
use common\models\City;
|
||||||
|
use yii\web\Controller;
|
||||||
|
use backend\models\GiroBeszedForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CityController implements the CRUD actions for City model.
|
||||||
|
*/
|
||||||
|
class TestController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function actionCreateBeszed(){
|
||||||
|
|
||||||
|
$model = new GiroBeszedForm();
|
||||||
|
|
||||||
|
if ($model->load(\Yii::$app->request->post()) ) {
|
||||||
|
$model->run();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render("_create_beszed",['model' => $model]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -184,6 +184,13 @@ class UgiroController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function actionGenerateDetsta(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the Ugiro model based on its primary key value.
|
* Finds the Ugiro model based on its primary key value.
|
||||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
|
|||||||
85
backend/models/GenerateDetstaForm.php
Normal file
85
backend/models/GenerateDetstaForm.php
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?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\components\giro\GiroDETSTA;
|
||||||
|
use common\models\Ugiro;
|
||||||
|
use common\components\giro\GiroDETSTAFej;
|
||||||
|
use common\components\giro\GiroDETSTALab;
|
||||||
|
use common\components\giro\GiroDETSTATetel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ContactForm is the model behind the contact form.
|
||||||
|
* @property \Yii\web\UploadedFile $file
|
||||||
|
*/
|
||||||
|
class CardImportRfidForm extends Model{
|
||||||
|
|
||||||
|
|
||||||
|
public $id_giro;
|
||||||
|
public $uzenet;
|
||||||
|
public $detstatUzenet;
|
||||||
|
|
||||||
|
public function rules(){
|
||||||
|
return [
|
||||||
|
[['id_giro'], 'safe']
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function run(){
|
||||||
|
|
||||||
|
$ugiro = Ugiro::findOne($this->id_giro);
|
||||||
|
$requests = $ugiro->requests;
|
||||||
|
|
||||||
|
$this->detstatUzenet = new GiroDETSTA();
|
||||||
|
|
||||||
|
$fej = new GiroDETSTAFej();
|
||||||
|
$fej->csoportosUzenetSorszam->osszeallitasDatuma = $ugiro->datum;
|
||||||
|
$fej->csoportosUzenetSorszam->sorszam = $ugiro->number;
|
||||||
|
$fej->detstaUzenetSorszam->osszeallitasDatuma = $ugiro->datum;
|
||||||
|
$fej->detstaUzenetSorszam->sorszam = $ugiro->number;
|
||||||
|
$fej->ido = "141414";
|
||||||
|
$fej->jelentesJelzo = "8";
|
||||||
|
$fej->kezdemenyezoAzonosito = \Yii::$app->params['ugiro_kezdemenyezo_azonosito'];
|
||||||
|
$fej->kezdemenyezoBankszamla = \Yii::$app->params['ugiro_kezdemenyezo_szamlaszam'];
|
||||||
|
|
||||||
|
$this->detstatUzenet->fej = $fej;
|
||||||
|
|
||||||
|
foreach ($requests as $request){
|
||||||
|
$tetel = new GiroDETSTATetel();
|
||||||
|
$tetel->tetelSorszam = $request->number;
|
||||||
|
$tetel->osszeg = $request->money;
|
||||||
|
$tetel->eredetiTetelElszamolasiDatuma = date('Ymd');
|
||||||
|
$tetel->visszajelzesInformacio = "00";
|
||||||
|
$tetel->feldolgozasDatum = date('Ymd');
|
||||||
|
$tetel->terhelesiDatum = date('Ymd');
|
||||||
|
$tetel->eredetiHivatkozasiKod = "abc123";
|
||||||
|
$tetel->ugyfelAzonosito = $request->id_customer;
|
||||||
|
|
||||||
|
$this->detstatUzenet->tetelek[] = $tetel;
|
||||||
|
}
|
||||||
|
|
||||||
|
$lab = new GiroDETSTALab();
|
||||||
|
$lab->teljesitettTetelekSzama = 0;
|
||||||
|
$lab->teljesitettTetelekOsszerteke = 0;
|
||||||
|
$lab->megNemValaszoltTetelekOsszerteke = 0;
|
||||||
|
$lab->megNemValaszoltTetelekSzama = 0;
|
||||||
|
$lab->visszautasitottTetelekOsszerteke = 0;
|
||||||
|
$lab->visszautasitottTetelekSzama = 0;
|
||||||
|
|
||||||
|
$this->detstatUzenet->lab = $lab;
|
||||||
|
|
||||||
|
|
||||||
|
$this->uzenet = $this->detstatUzenet->toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
183
backend/models/GiroBeszedForm.php
Normal file
183
backend/models/GiroBeszedForm.php
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
<?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\components\giro\GiroBeszed;
|
||||||
|
use common\components\giro\GiroBeszedFej;
|
||||||
|
use common\components\giro\GiroBeszedLab;
|
||||||
|
use common\components\giro\GiroBeszedTetel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ContactForm is the model behind the contact form.
|
||||||
|
* @property string 'fej_recordTipus'
|
||||||
|
@property string 'uzenetTipus'
|
||||||
|
@property string 'duplumKod'
|
||||||
|
@property string 'kezdemenyezoAzonosito'
|
||||||
|
|
||||||
|
@property string 'uzenetSorszam'
|
||||||
|
@property string 'kezdemenyezoBankszamla'
|
||||||
|
|
||||||
|
@property string 'ertesitesiHatarido'
|
||||||
|
@property string 'jogcim'
|
||||||
|
@property string 'kezdemenyezoCegNeve'
|
||||||
|
@property string 'fej_kozlemeny'
|
||||||
|
|
||||||
|
|
||||||
|
@property string 'lab_rekordTipus'
|
||||||
|
@property string 'tetelekSzama'
|
||||||
|
@property string 'tetelekOsszerteke'
|
||||||
|
|
||||||
|
@property string 'rekordTipus'
|
||||||
|
@property string 'tetelSorszam'
|
||||||
|
@property string 'terhelesiDatum'
|
||||||
|
@property string 'osszeg'
|
||||||
|
@property string 'kotelezettBankszamla'
|
||||||
|
@property string 'ugyfelazonositoAKezdemenyezonel'
|
||||||
|
@property string 'ugyfelNeve'
|
||||||
|
@property string 'ugyfelCime'
|
||||||
|
@property string 'szamlaTulajdonosNeve'
|
||||||
|
@property string 'kozlemeny'
|
||||||
|
|
||||||
|
*/
|
||||||
|
class GiroBeszedForm extends Model{
|
||||||
|
|
||||||
|
public $uzenet_szoveg;
|
||||||
|
|
||||||
|
/**fej*/
|
||||||
|
public $fej_recordTipus = "01";
|
||||||
|
public $uzenetTipus = "BESZED";
|
||||||
|
public $duplumKod = "1";
|
||||||
|
public $kezdemenyezoAzonosito = "A25366936T244";
|
||||||
|
// public $uzenetSorszam;
|
||||||
|
|
||||||
|
public $fej_osszeallitasDatuma ;
|
||||||
|
public $fej_sorszam = 1;
|
||||||
|
|
||||||
|
public $kezdemenyezoBankszamla = "5860025215371128";
|
||||||
|
|
||||||
|
public $ertesitesiHatarido;
|
||||||
|
public $jogcim = "BEE";
|
||||||
|
public $kezdemenyezoCegNeve = "test cég";
|
||||||
|
public $fej_kozlemeny = "Ez a közlemény a fejben";
|
||||||
|
|
||||||
|
/**lab*/
|
||||||
|
public $lab_rekordTipus = "03";
|
||||||
|
public $tetelekSzama = 1;
|
||||||
|
public $tetelekOsszerteke = 1000;
|
||||||
|
|
||||||
|
/**tetel*/
|
||||||
|
public $rekordTipus = "02";
|
||||||
|
public $tetelSorszam = 1;
|
||||||
|
public $terhelesiDatum = "";
|
||||||
|
public $osszeg = 1000;
|
||||||
|
public $kotelezettBankszamla = "5860025215371128";
|
||||||
|
public $ugyfelazonositoAKezdemenyezonel = "199991";
|
||||||
|
public $ugyfelNeve;
|
||||||
|
public $ugyfelCime;
|
||||||
|
public $szamlaTulajdonosNeve = "Schneider Roland";
|
||||||
|
public $kozlemeny ="Fitness bérlet";
|
||||||
|
|
||||||
|
public function init(){
|
||||||
|
parent::init();
|
||||||
|
|
||||||
|
$this->fej_osszeallitasDatuma = date('Ymd');
|
||||||
|
$this->ertesitesiHatarido = date('Ymd');
|
||||||
|
$this->terhelesiDatum = date('Ymd', strtotime('tomorrow'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function rules(){
|
||||||
|
return [
|
||||||
|
[ [ 'fej_recordTipus' ,
|
||||||
|
'uzenetTipus' ,
|
||||||
|
'duplumKod' ,
|
||||||
|
'kezdemenyezoAzonosito' ,
|
||||||
|
|
||||||
|
// 'uzenetSorszam' ,
|
||||||
|
'fej_osszeallitasDatuma',
|
||||||
|
'fej_sorszam',
|
||||||
|
|
||||||
|
'kezdemenyezoBankszamla' ,
|
||||||
|
|
||||||
|
'ertesitesiHatarido' ,
|
||||||
|
'jogcim' ,
|
||||||
|
'kezdemenyezoCegNeve' ,
|
||||||
|
'kozlemeny' ,
|
||||||
|
|
||||||
|
|
||||||
|
'rekordTipus' ,
|
||||||
|
'tetelekSzama' ,
|
||||||
|
'tetelekOsszerteke' ,
|
||||||
|
|
||||||
|
'rekordTipus' ,
|
||||||
|
'tetelSorszam' ,
|
||||||
|
'terhelesiDatum' ,
|
||||||
|
'osszeg' ,
|
||||||
|
'kotelezettBankszamla' ,
|
||||||
|
'ugyfelazonositoAKezdemenyezonel' ,
|
||||||
|
'ugyfelNeve' ,
|
||||||
|
'ugyfelCime' ,
|
||||||
|
'szamlaTulajdonosNeve' ,
|
||||||
|
'kozlemeny' ,] ,'string']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function run(){
|
||||||
|
$this->validate();
|
||||||
|
$uzenet = new GiroBeszed();
|
||||||
|
$fej = new GiroBeszedFej();
|
||||||
|
$lab = new GiroBeszedLab();
|
||||||
|
$tetel = new GiroBeszedTetel();
|
||||||
|
|
||||||
|
|
||||||
|
$fej->recordTipus = $this->fej_recordTipus;
|
||||||
|
$fej->uzenetTipus = $this->uzenetTipus;
|
||||||
|
$fej->duplumKod = $this->duplumKod;
|
||||||
|
$fej->kezdemenyezoAzonosito = $this->kezdemenyezoAzonosito;
|
||||||
|
$fej->uzenetSorszam->osszeallitasDatuma = $this->fej_osszeallitasDatuma;
|
||||||
|
$fej->uzenetSorszam->sorszam = $this->fej_sorszam;
|
||||||
|
$fej->kezdemenyezoBankszamla->szamlaszam = $this->kezdemenyezoBankszamla;
|
||||||
|
$fej->ertesitesiHatarido = $this->ertesitesiHatarido;
|
||||||
|
$fej->jogcim = $this->jogcim;
|
||||||
|
$fej->kezdemenyezoCegNeve = $this->kezdemenyezoCegNeve;
|
||||||
|
$fej->kozlemeny = $this->fej_kozlemeny;
|
||||||
|
|
||||||
|
//
|
||||||
|
/***/
|
||||||
|
|
||||||
|
$lab->rekordTipus = $this->lab_rekordTipus;
|
||||||
|
$lab->tetelekSzama = $this->tetelekSzama;
|
||||||
|
$lab->tetelekOsszerteke = $this->tetelekOsszerteke;
|
||||||
|
|
||||||
|
//tetel
|
||||||
|
|
||||||
|
|
||||||
|
$tetel->rekordTipus = $this->rekordTipus;
|
||||||
|
$tetel->tetelSorszam = $this->tetelSorszam;
|
||||||
|
$tetel->terhelesiDatum = $this->terhelesiDatum;
|
||||||
|
$tetel->osszeg = $this->osszeg;
|
||||||
|
$tetel->kotelezettBankszamla->szamlaszam = $this->kotelezettBankszamla;
|
||||||
|
$tetel->ugyfelazonositoAKezdemenyezonel = $this->ugyfelazonositoAKezdemenyezonel;
|
||||||
|
$tetel->ugyfelNeve = $this->ugyfelNeve;
|
||||||
|
$tetel->ugyfelCime = $this->ugyfelCime;
|
||||||
|
$tetel->szamlaTulajdonosNeve = $this->szamlaTulajdonosNeve;
|
||||||
|
$tetel->kozlemeny = $this->kozlemeny;
|
||||||
|
|
||||||
|
$uzenet->fej = $fej;
|
||||||
|
$uzenet->tetelek[] = $tetel;
|
||||||
|
$uzenet->lab = $lab;
|
||||||
|
|
||||||
|
$this->uzenet_szoveg = $uzenet->toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -80,7 +80,11 @@ class GiroKotegForm extends Model{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function assignRequestsToUgiro(){
|
public function assignRequestsToUgiro(){
|
||||||
|
$i = 0;
|
||||||
foreach ($this->requests as $request){
|
foreach ($this->requests as $request){
|
||||||
|
$i++;
|
||||||
|
$request->number = $i;
|
||||||
|
$request->save(false);
|
||||||
$assignment = new UgiroRequestAssignment();
|
$assignment = new UgiroRequestAssignment();
|
||||||
$assignment->id_request = $request->id_ticket_installment_request;
|
$assignment->id_request = $request->id_ticket_installment_request;
|
||||||
$assignment->id_ugiro = $this->koteg->id_ugiro;
|
$assignment->id_ugiro = $this->koteg->id_ugiro;
|
||||||
|
|||||||
4
backend/views/test/_create_beszed.php
Normal file
4
backend/views/test/_create_beszed.php
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
create beszed
|
||||||
|
|
||||||
|
|
||||||
|
<?php echo $this->render('beszed_form', ['model' => $model]); ?>
|
||||||
52
backend/views/test/beszed_form.php
Normal file
52
backend/views/test/beszed_form.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model backend\models\GiroBeszedForm */
|
||||||
|
/* @var $form ActiveForm */
|
||||||
|
?>
|
||||||
|
<div class="test-beszed_form">
|
||||||
|
|
||||||
|
<textarea rows="10" cols="200"><?php echo $model->uzenet_szoveg?></textarea>
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
<h2>fej</h2>
|
||||||
|
<?= $form->field($model, 'fej_recordTipus') ?>
|
||||||
|
<?= $form->field($model, 'uzenetTipus') ?>
|
||||||
|
<?= $form->field($model, 'duplumKod') ?>
|
||||||
|
<?= $form->field($model, 'kezdemenyezoAzonosito') ?>
|
||||||
|
|
||||||
|
<?php // $form->field($model, 'uzenetSorszam') ?>
|
||||||
|
<?= $form->field($model, 'fej_osszeallitasDatuma') ?>
|
||||||
|
<?= $form->field($model, 'fej_sorszam') ?>
|
||||||
|
|
||||||
|
|
||||||
|
<?= $form->field($model, 'kezdemenyezoBankszamla') ?>
|
||||||
|
<?= $form->field($model, 'ertesitesiHatarido') ?>
|
||||||
|
<?= $form->field($model, 'jogcim') ?>
|
||||||
|
<?= $form->field($model, 'kezdemenyezoCegNeve') ?>
|
||||||
|
<?= $form->field($model, 'fej_kozlemeny') ?>
|
||||||
|
<?php /**lab*/?>
|
||||||
|
<h2>Lab</h2>
|
||||||
|
<?= $form->field($model, 'lab_rekordTipus') ?>
|
||||||
|
<?= $form->field($model, 'tetelekSzama') ?>
|
||||||
|
<?= $form->field($model, 'tetelekOsszerteke') ?>
|
||||||
|
<h2>Tetel</h2>
|
||||||
|
<?php /*** tetel*/?>
|
||||||
|
<?= $form->field($model, 'tetelSorszam') ?>
|
||||||
|
<?= $form->field($model, 'terhelesiDatum') ?>
|
||||||
|
<?= $form->field($model, 'osszeg') ?>
|
||||||
|
<?= $form->field($model, 'kotelezettBankszamla') ?>
|
||||||
|
<?= $form->field($model, 'ugyfelazonositoAKezdemenyezonel') ?>
|
||||||
|
<?= $form->field($model, 'ugyfelNeve') ?>
|
||||||
|
<?= $form->field($model, 'ugyfelCime') ?>
|
||||||
|
<?= $form->field($model, 'szamlaTulajdonosNeve') ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton('Submit', ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div><!-- test-beszed_form -->
|
||||||
@ -6,10 +6,20 @@ use \Yii;
|
|||||||
|
|
||||||
class Helper {
|
class Helper {
|
||||||
|
|
||||||
public static function getDateTimeString(){
|
public static function getDateTimeString( ){
|
||||||
|
|
||||||
return date("Y-m-d H:i:s");
|
return date("Y-m-d H:i:s");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getArrayValue($arr,$key,$def){
|
||||||
|
$result = $def;
|
||||||
|
if ( array_key_exists($key, $arr)){
|
||||||
|
$result = $arr[$key];
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function hufRound($m) {
|
public static function hufRound($m) {
|
||||||
$result = round ( $m / 5, 0 ) * 5;
|
$result = round ( $m / 5, 0 ) * 5;
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@ -5,13 +5,16 @@ namespace common\components\giro;
|
|||||||
use common\components\giro\GiroBase;
|
use common\components\giro\GiroBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*@property common\components\giro\GiroBeszedFej $fej
|
||||||
* @property common\components\giro\GiroUzenetsorszam $uzenetSorszam
|
*@property common\components\giro\GiroBeszedLab $lab
|
||||||
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
|
*@property common\components\giro\GiroBeszedTetel[] $tetelek
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class GiroBeszed extends GiroBase {
|
class GiroBeszed extends GiroBase {
|
||||||
|
|
||||||
|
public $fej;
|
||||||
|
public $lab;
|
||||||
|
public $tetelek = [];
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
}
|
}
|
||||||
@ -36,7 +39,7 @@ class GiroBeszed extends GiroBase {
|
|||||||
$fej->kezdemenyezoBankszamla->szamlaszam = \Yii::$app->params['ugiro_kezdemenyezo_szamlaszam']; // "5860025215371128";
|
$fej->kezdemenyezoBankszamla->szamlaszam = \Yii::$app->params['ugiro_kezdemenyezo_szamlaszam']; // "5860025215371128";
|
||||||
// $fej->kezdemenyezoBankszamla->bankszerv = "58600252"; // "TAKBHUHB";
|
// $fej->kezdemenyezoBankszamla->bankszerv = "58600252"; // "TAKBHUHB";
|
||||||
$fej->ertesitesiHatarido = "";
|
$fej->ertesitesiHatarido = "";
|
||||||
$fej->kezdemenyezoCegNeve = \Yii::$app->params['company'];
|
$fej->kezdemenyezoCegNeve = \Yii::$app->params['company_name'];
|
||||||
|
|
||||||
return $fej->toString ();
|
return $fej->toString ();
|
||||||
}
|
}
|
||||||
@ -57,12 +60,12 @@ class GiroBeszed extends GiroBase {
|
|||||||
public static function createTetel($request,$sorszam,$terhelesiDatum) {
|
public static function createTetel($request,$sorszam,$terhelesiDatum) {
|
||||||
$tetel = new GiroBeszedTetel ();
|
$tetel = new GiroBeszedTetel ();
|
||||||
$customer = $request->customer;
|
$customer = $request->customer;
|
||||||
$tetel->tetelSorszam = $sorszam;
|
$tetel->tetelSorszam = $request->number;
|
||||||
$tetel->terhelesiDatum = $terhelesiDatum;
|
$tetel->terhelesiDatum = $terhelesiDatum;
|
||||||
$tetel->osszeg = $request->money;
|
$tetel->osszeg = $request->money;
|
||||||
// $tetel->kotelezettBankszamla->bankszerv = "58600252";
|
// $tetel->kotelezettBankszamla->bankszerv = "58600252";
|
||||||
$tetel->kotelezettBankszamla->szamlaszam = $customer->bank_account;
|
$tetel->kotelezettBankszamla->szamlaszam = $customer->bank_account;
|
||||||
$tetel->ugyfelazonositoAKezdemenyezonel = $request->id_ticket_installment_request;
|
$tetel->ugyfelazonositoAKezdemenyezonel = $customer->id_customer;
|
||||||
// $tetel->ugyfelNeve = "Schneider Roland";
|
// $tetel->ugyfelNeve = "Schneider Roland";
|
||||||
// $tetel->ugyfelCime = "Mosonmagyarovar, Gardonyi 31";
|
// $tetel->ugyfelCime = "Mosonmagyarovar, Gardonyi 31";
|
||||||
$tetel->szamlaTulajdonosNeve = $customer->name;
|
$tetel->szamlaTulajdonosNeve = $customer->name;
|
||||||
@ -84,4 +87,18 @@ class GiroBeszed extends GiroBase {
|
|||||||
|
|
||||||
return $lab->toString ();
|
return $lab->toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function toString( ) {
|
||||||
|
$s = "";
|
||||||
|
$s .= $this->fej->toString();
|
||||||
|
|
||||||
|
foreach ($this->tetelek as $tetel ){
|
||||||
|
$s .= $tetel->toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
$s .= $this->lab->toString();
|
||||||
|
return $s;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -9,7 +9,38 @@ use common\components\giro\GiroBase;
|
|||||||
class GiroBeszedTetel extends GiroBase{
|
class GiroBeszedTetel extends GiroBase{
|
||||||
|
|
||||||
public $rekordTipus = "02";
|
public $rekordTipus = "02";
|
||||||
|
/**
|
||||||
|
* 3 – 8
|
||||||
|
T211
|
||||||
|
tételsorszám
|
||||||
|
N
|
||||||
|
6
|
||||||
|
K
|
||||||
|
* */
|
||||||
public $tetelSorszam = 0;
|
public $tetelSorszam = 0;
|
||||||
|
/**
|
||||||
|
* @var string $terhelesiDatum
|
||||||
|
* 9 – 16
|
||||||
|
T212
|
||||||
|
terhelési / esedékességi dátum
|
||||||
|
N
|
||||||
|
8
|
||||||
|
ééééhhnn
|
||||||
|
K
|
||||||
|
ezen a dátumon (év, hó, nap) kell megterhelni a kötelezett számláját a beszedendő összeggel
|
||||||
|
* Ellenőrzés
|
||||||
|
* 9 – 16
|
||||||
|
T212
|
||||||
|
terhelési / esedékességi dátum 1
|
||||||
|
érvényes / időhatáron belüli
|
||||||
|
dátum?
|
||||||
|
E <= D <= E + 8 ?
|
||||||
|
33 T
|
||||||
|
érvénytelen terhelési dátum
|
||||||
|
*
|
||||||
|
* A ’D’ terhelési dátumnak érvényes naptári napnak kell lennie, valamint nem lehet kisebb
|
||||||
|
és legfeljebb 8 munka- / elszámolási nappal lehet későbbi, mint az ’E’ elszámolási dátum.
|
||||||
|
* */
|
||||||
public $terhelesiDatum = "";
|
public $terhelesiDatum = "";
|
||||||
public $osszeg;
|
public $osszeg;
|
||||||
public $kotelezettBankszamla;
|
public $kotelezettBankszamla;
|
||||||
|
|||||||
@ -47,4 +47,24 @@ class GiroDETSTA extends GiroBase {
|
|||||||
return $detsta;
|
return $detsta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param common\components\giro\GiroBeszed $beszed
|
||||||
|
* */
|
||||||
|
public static function createBeszedAnswer($beszed){
|
||||||
|
// /**@var common\components\giro\GiroBeszed $beszed*/
|
||||||
|
$beszed = new GiroBeszed();
|
||||||
|
$detsta = new GiroDETSTA();
|
||||||
|
$detsta->fej = new GiroDETSTAFej();
|
||||||
|
|
||||||
|
$detsta->fej->jelentesJelzo = 8;
|
||||||
|
$detsta->fej->kezdemenyezoAzonosito = $beszed->fej->kezdemenyezoAzonosito;
|
||||||
|
$detsta->fej->csoportosUzenetSorszam->osszeallitasDatuma = $beszed->fej->uzenetSorszam->osszeallitasDatuma;
|
||||||
|
$detsta->fej->csoportosUzenetSorszam->sorszam = $beszed->fej->uzenetSorszam->sorszam;
|
||||||
|
$detsta->fej->detstaUzenetSorszam->osszeallitasDatuma = $beszed->fej->uzenetSorszam->osszeallitasDatuma;
|
||||||
|
$detsta->fej->detstaUzenetSorszam = $beszed->fej->uzenetSorszam->sorszam;
|
||||||
|
|
||||||
|
|
||||||
|
$detsta->lab = new GiroDETSTALab();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -4,8 +4,13 @@ namespace common\components\giro;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @property common\components\giro\GiroUzenetsorszam $csoportosUzenetSorszam
|
* @property string $recordTipus
|
||||||
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
|
* @property string $teljesitettTetelekSzama
|
||||||
|
* @property string $teljesitettTetelekOsszerteke
|
||||||
|
* @property string $visszautasitottTetelekSzama
|
||||||
|
* @property string $visszautasitottTetelekSzama
|
||||||
|
* @property string $megNemValaszoltTetelekSzama
|
||||||
|
* @property string $megNemValaszoltTetelekOsszerteke
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class GiroDETSTALab extends GiroBase {
|
class GiroDETSTALab extends GiroBase {
|
||||||
|
|||||||
@ -25,6 +25,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
|||||||
const TYPE_QRCODE = 20;
|
const TYPE_QRCODE = 20;
|
||||||
const TYPE_BARCODE = 30;
|
const TYPE_BARCODE = 30;
|
||||||
const TYPE_OLD = 40;
|
const TYPE_OLD = 40;
|
||||||
|
const TYPE_EMPLOYEE = 50;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
@ -95,6 +96,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
|||||||
self::TYPE_QRCODE => Yii::t('common/card', 'QRCODE'),
|
self::TYPE_QRCODE => Yii::t('common/card', 'QRCODE'),
|
||||||
self::TYPE_BARCODE => Yii::t('common/card', 'BARCODE'),
|
self::TYPE_BARCODE => Yii::t('common/card', 'BARCODE'),
|
||||||
self::TYPE_OLD => Yii::t('common/card', 'OLD'),
|
self::TYPE_OLD => Yii::t('common/card', 'OLD'),
|
||||||
|
self::TYPE_EMPLOYEE => Yii::t('common/card', 'Munkatárs'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
172
common/models/Contract.php
Normal file
172
common/models/Contract.php
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
<?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 "contract".
|
||||||
|
*
|
||||||
|
* @property integer $id_contract
|
||||||
|
* @property integer $id_user
|
||||||
|
* @property integer $id_customer
|
||||||
|
* @property integer $status
|
||||||
|
* @property integer $flag
|
||||||
|
* @property integer $part_paid
|
||||||
|
* @property integer $part_count
|
||||||
|
* @property integer $part_required
|
||||||
|
* @property integer $id_ticket_type
|
||||||
|
* @property string $expired_at
|
||||||
|
* @property string $created_at
|
||||||
|
* @property string $updated_at
|
||||||
|
*/
|
||||||
|
class Contract extends \yii\db\ActiveRecord
|
||||||
|
{
|
||||||
|
|
||||||
|
public static $STATUS_PAID = 10;
|
||||||
|
public static $STATUS_NOT_PAID = 20;
|
||||||
|
|
||||||
|
public static $FLAG_DELETED = 10;
|
||||||
|
public static $FLAG_CANCELED = 20;
|
||||||
|
public static $FLAG_ACTIVE= 30;
|
||||||
|
public static $FLAG_EXPIRED = 40;
|
||||||
|
|
||||||
|
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return ArrayHelper::merge( [
|
||||||
|
[
|
||||||
|
'class' => TimestampBehavior::className(),
|
||||||
|
'value' => function(){ return Helper::getDateTimeString(); }
|
||||||
|
],
|
||||||
|
], parent::behaviors());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public static function tableName()
|
||||||
|
{
|
||||||
|
return 'contract';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// [['id_user', 'id_customer', 'status', 'flag', 'part_paid', 'part_count', 'part_required'], 'integer'],
|
||||||
|
// [['expired_at', 'created_at', 'updated_at'], 'required'],
|
||||||
|
// [['expired_at', 'created_at', 'updated_at'], 'safe']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id_contract' => Yii::t('common/contract', 'Szerződés azonosító'),
|
||||||
|
'id_user' => Yii::t('common/contract', 'Felhasználó'),
|
||||||
|
'id_customer' => Yii::t('common/contract', 'Vendég'),
|
||||||
|
'status' => Yii::t('common/contract', 'Státusz'),
|
||||||
|
'flag' => Yii::t('common/contract', 'Flag'),
|
||||||
|
'part_count' => Yii::t('common/contract', 'Részletek száma'),
|
||||||
|
'part_paid' => Yii::t('common/contract', 'Fizetett részletek'),
|
||||||
|
'part_required' => Yii::t('common/contract', 'Esedékes részlet'),
|
||||||
|
'expired_at' => Yii::t('common/contract', 'Lejárati dátum'),
|
||||||
|
'created_at' => Yii::t('common/contract', 'Létrehozva'),
|
||||||
|
'updated_at' => Yii::t('common/contract', 'Updated At'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTicketType(){
|
||||||
|
return $this->hasOne(TicketType::className(), ['id_ticket_type' => 'id_ticket_type']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCustomer(){
|
||||||
|
return $this->hasOne(Customer::className(), ['id_customer' => 'id_customer']);
|
||||||
|
}
|
||||||
|
public function getCustomerName(){
|
||||||
|
$customer = $this->customer;
|
||||||
|
$result = "";
|
||||||
|
|
||||||
|
if ( isset($customer)){
|
||||||
|
$result = $customer->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
public function getUser(){
|
||||||
|
return $this->hasOne(User::className(), ['id' => 'id_user']);
|
||||||
|
}
|
||||||
|
public function getUserName(){
|
||||||
|
$user = $this->user;
|
||||||
|
$result = "";
|
||||||
|
|
||||||
|
if ( isset($user)){
|
||||||
|
$result = $user->username;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequests(){
|
||||||
|
return $this->hasMany(TicketInstallmentRequest::className(), ['id_contract' => 'id_contract']);
|
||||||
|
}
|
||||||
|
// public static $STATUS_PAID = 10;
|
||||||
|
// public static $STATUS_NOT_PAID = 20;
|
||||||
|
|
||||||
|
// public static $FLAG_DELETED = 10;
|
||||||
|
// public static $FLAG_CANCELED = 20;
|
||||||
|
// public static $FLAG_ACTIVE= 30;
|
||||||
|
// public static $FLAG_EXPIRED = 40;
|
||||||
|
|
||||||
|
|
||||||
|
public static function statuses(){
|
||||||
|
return [
|
||||||
|
static::$STATUS_NOT_PAID => "Nincs fizetve",
|
||||||
|
static::$STATUS_PAID => "Fizetve",
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function flags(){
|
||||||
|
return [
|
||||||
|
static::$FLAG_ACTIVE => "Aktív",
|
||||||
|
static::$FLAG_CANCELED => "Felbontva",
|
||||||
|
static::$FLAG_DELETED => "Törölve",
|
||||||
|
static::$FLAG_EXPIRED => "Lejárt",
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function toStatusName($status){
|
||||||
|
return Helper::getArrayValue(self::statuses(), $status, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function toFlangName($flag){
|
||||||
|
return Helper::getArrayValue(self::flags(), $flag, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatusName() {
|
||||||
|
return self::toStatusName($this->status);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFlagName() {
|
||||||
|
return self::toFlangName($this->flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function isStatusNotPaid(){
|
||||||
|
return $this->status == static::$STATUS_NOT_PAID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function canCancel() {
|
||||||
|
return $this->flag == static::$FLAG_ACTIVE;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -29,6 +29,8 @@ class Product extends \common\models\BaseFitnessActiveRecord {
|
|||||||
const STATUS_DELETED = 0;
|
const STATUS_DELETED = 0;
|
||||||
const STATUS_ACTIVE = 10;
|
const STATUS_ACTIVE = 10;
|
||||||
|
|
||||||
|
public static $BUNTETES = "buntetes3000";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -108,6 +108,9 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
|
|||||||
public function getCustomer(){
|
public function getCustomer(){
|
||||||
return $this->hasOne( Customer::className(), ["id_customer" =>"id_customer" ] );
|
return $this->hasOne( Customer::className(), ["id_customer" =>"id_customer" ] );
|
||||||
}
|
}
|
||||||
|
public function getContract(){
|
||||||
|
return $this->hasOne( Contract::className(), ["id_contract" =>"id_contract" ] );
|
||||||
|
}
|
||||||
|
|
||||||
public function getTicket(){
|
public function getTicket(){
|
||||||
return $this->hasOne( Ticket::className(), ["id_ticket" =>"id_ticket", ] ) ;
|
return $this->hasOne( Ticket::className(), ["id_ticket" =>"id_ticket", ] ) ;
|
||||||
@ -119,13 +122,27 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
|
|||||||
->viaTable('ugiro_request_assignment', [ 'id_request' => 'id_ticket_installment_request' ]);
|
->viaTable('ugiro_request_assignment', [ 'id_request' => 'id_ticket_installment_request' ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTicketExpirationDate(){
|
||||||
|
return strtotime( $this->request_target_time_at . " +1 month -1 day") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function isStatusAccepted(){
|
public function isStatusAccepted(){
|
||||||
return $this->status == static::$STATUS_ACCEPTED || $this->status == static::$STATUS_ACCEPTED_MANUAL;
|
return $this->status == static::$STATUS_ACCEPTED || $this->status == static::$STATUS_ACCEPTED_MANUAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isStatusRejected(){
|
public function isStatusRejected(){
|
||||||
return $this->status == static::$STATUS_REJECTED ;
|
return $this->status == static::$STATUS_REJECTED ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isStatusCanceled(){
|
||||||
|
return $this->status == static::$STATUS_CANCELED ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isStatusPending(){
|
||||||
|
return $this->status == static::$STATUS_PENDING ;
|
||||||
|
}
|
||||||
|
|
||||||
public function getIdGiro(){
|
public function getIdGiro(){
|
||||||
$result = null;
|
$result = null;
|
||||||
$giro = $this->ugiro;
|
$giro = $this->ugiro;
|
||||||
@ -145,12 +162,15 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
|
|||||||
public function applyStatus($status, $partRequired = false, $visszajelzes = "", $comment = ""){
|
public function applyStatus($status, $partRequired = false, $visszajelzes = "", $comment = ""){
|
||||||
if ( $status == static::$STATUS_ACCEPTED || $status == static::$STATUS_ACCEPTED_MANUAL){
|
if ( $status == static::$STATUS_ACCEPTED || $status == static::$STATUS_ACCEPTED_MANUAL){
|
||||||
if ( !$this->isStatusAccepted() ){
|
if ( !$this->isStatusAccepted() ){
|
||||||
$this->status = $status;
|
|
||||||
$tranfer = $this->addTransfer();
|
$tranfer = $this->addTransfer();
|
||||||
|
$this->status = $status;
|
||||||
$this->id_transfer = $tranfer->id_transfer;
|
$this->id_transfer = $tranfer->id_transfer;
|
||||||
$this->request_processed_at = Helper::getDateTimeString();
|
$this->request_processed_at = Helper::getDateTimeString();
|
||||||
$this->save(false);
|
$this->save(false);
|
||||||
$this->applyNewTicketState($partRequired);
|
|
||||||
|
|
||||||
|
|
||||||
|
// $this->applyNewTicketState($partRequired);
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
return false;
|
return false;
|
||||||
@ -161,18 +181,19 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
|
|||||||
$this->comment = $comment;
|
$this->comment = $comment;
|
||||||
$this->request_processed_at = Helper::getDateTimeString();
|
$this->request_processed_at = Helper::getDateTimeString();
|
||||||
$this->save(false);
|
$this->save(false);
|
||||||
$this->applyNewTicketState($partRequired);
|
// $this->applyNewTicketState($partRequired);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function applyNewTicketState($partRequired = false){
|
// protected function applyNewTicketState($partRequired = false){
|
||||||
if ( $partRequired ){
|
// if ( $partRequired ){
|
||||||
$this->ticket->setPartRequired($this);
|
// $this->ticket->setPartRequired($this);
|
||||||
}
|
// }
|
||||||
$this->ticket->applyTicketInstallmentRequest($this);
|
// $this->ticket->applyTicketInstallmentRequest($this);
|
||||||
$this->ticket->save(false);
|
// $this->ticket->save(false);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
protected function addTransfer(){
|
protected function addTransfer(){
|
||||||
|
|
||||||
@ -202,18 +223,18 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
|
|||||||
* @param common\models\TicketType $type
|
* @param common\models\TicketType $type
|
||||||
* @return common\models\TicketInstallmentRequest[]
|
* @return common\models\TicketInstallmentRequest[]
|
||||||
* */
|
* */
|
||||||
public static function createInstallments($ticket,$type,$customer){
|
public static function createInstallments($ticket,$type,$customer,$contract){
|
||||||
$result = [];
|
$result = [];
|
||||||
if ( $type->isInstallment() ){
|
if ( $type->isInstallment() ){
|
||||||
$count = $type->installment_count;
|
$count = $type->installment_count;
|
||||||
$discount = $ticket->discount;
|
$discount = $ticket->discount;
|
||||||
$money = $type->price_brutto;
|
$money = $type->installment_money;
|
||||||
if ( isset($discount ) ){
|
if ( isset($discount ) ){
|
||||||
$money = Discount::applyDiscount($money, $discount);
|
$money = Discount::applyDiscount($money, $discount);
|
||||||
}
|
}
|
||||||
$ticketCreatedAt = time();
|
$ticketCreatedAt = time();
|
||||||
for ( $i = 1; $i <= $count; $i++){
|
for ( $i = 1; $i <= $count; $i++){
|
||||||
$request = TicketInstallmentRequest::createInstallment($ticket, $type, $customer, $money, $ticketCreatedAt, $i);
|
$request = TicketInstallmentRequest::createInstallment($ticket, $type, $customer, $contract, $money, $ticketCreatedAt, $i);
|
||||||
$result[] = $request;
|
$result[] = $request;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +242,7 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createInstallment($ticket,$type,$customer,$money,$ticketCreated,$index){
|
public static function createInstallment($ticket,$type,$customer,$contract,$money,$ticketCreated,$index){
|
||||||
$request = new TicketInstallmentRequest();
|
$request = new TicketInstallmentRequest();
|
||||||
$request->id_ticket = $ticket->id_ticket;
|
$request->id_ticket = $ticket->id_ticket;
|
||||||
$request->id_customer = $customer->id_customer;
|
$request->id_customer = $customer->id_customer;
|
||||||
@ -231,6 +252,7 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
|
|||||||
$request->request_processed_at = null;
|
$request->request_processed_at = null;
|
||||||
$request->request_sent_at = null;
|
$request->request_sent_at = null;
|
||||||
$request->money = $money;
|
$request->money = $money;
|
||||||
|
$request->id_contract = $contract->id_contract;
|
||||||
|
|
||||||
return $request;
|
return $request;
|
||||||
}
|
}
|
||||||
@ -257,4 +279,8 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getStatusName(){
|
||||||
|
return static::toStatusName($this->status);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -271,7 +271,7 @@ class TransferSaleSearch extends Transfer
|
|||||||
protected function readProducts(){
|
protected function readProducts(){
|
||||||
|
|
||||||
$query = (new \yii\db\Query());
|
$query = (new \yii\db\Query());
|
||||||
$query->select([ 'transfer.id_transfer as id_transfer', 'customer.name as customer_name' ,'user.username as user_name','account.name as account_name' , 'product_category.name as product_category_name', 'product.name as product_name', 'transfer.money AS product_money', 'transfer.count AS product_count', 'transfer.money AS product_money','transfer.item_price AS product_item_price', 'transfer.created_at as product_created_at','transfer.paid_at as product_paid_at']);
|
$query->select([ 'transfer.payment_method as transfer_payment_method', 'transfer.id_transfer as id_transfer', 'customer.name as customer_name' ,'user.username as user_name','account.name as account_name' , 'product_category.name as product_category_name', 'product.name as product_name', 'transfer.money AS product_money', 'transfer.count AS product_count', 'transfer.money AS product_money','transfer.item_price AS product_item_price', 'transfer.created_at as product_created_at','transfer.paid_at as product_paid_at']);
|
||||||
$query->from('transfer');
|
$query->from('transfer');
|
||||||
$query->andWhere(['transfer.type' => Transfer::TYPE_PRODUCT]);
|
$query->andWhere(['transfer.type' => Transfer::TYPE_PRODUCT]);
|
||||||
$query->innerJoin("sale", "sale.id_sale = transfer.id_object");
|
$query->innerJoin("sale", "sale.id_sale = transfer.id_object");
|
||||||
|
|||||||
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m160123_222804_alter__table__ticket_installment_request__add__column__ugiro__number extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->addColumn("ticket_installment_request", "number", "int");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
echo "m160123_222804_alter__table__ticket_installment_request__add__column__ugiro__number cannot be reverted.\n";
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
50
console/migrations/m160124_135213_add__table__contract.php
Normal file
50
console/migrations/m160124_135213_add__table__contract.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m160124_135213_add__table__contract extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$tableOptions = null;
|
||||||
|
if ($this->db->driverName === 'mysql') {
|
||||||
|
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
|
||||||
|
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->createTable('{{%contract}}', [
|
||||||
|
'id_contract' => $this->primaryKey(),
|
||||||
|
'id_user' => $this->integer(11),
|
||||||
|
'id_customer' => $this->integer(11),
|
||||||
|
'status' => $this->integer(11),
|
||||||
|
'flag' => $this->integer(11),
|
||||||
|
'part_paid' => $this->integer(11),
|
||||||
|
'part_count' => $this->integer(11),
|
||||||
|
'part_required' => $this->integer(11),
|
||||||
|
'expired_at' => $this->dateTime()->notNull(),
|
||||||
|
'created_at' => $this->dateTime()->notNull(),
|
||||||
|
'updated_at' => $this->dateTime()->notNull(),
|
||||||
|
], $tableOptions);
|
||||||
|
|
||||||
|
$this->addColumn("ticket", "id_contract", "int");
|
||||||
|
$this->addColumn("ticket_installment_request", "id_contract", "int");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m160124_204003_alter__table__contract__add__field__ticket_type extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->addColumn("contract", "id_ticket_type", "int");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
echo "m160124_204003_alter__table__contract__add__field__ticket_type cannot be reverted.\n";
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
44
console/migrations/m160124_235346_add_product_buntetes.php
Normal file
44
console/migrations/m160124_235346_add_product_buntetes.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
use common\models\Product;
|
||||||
|
use common\models\ProductCategory;
|
||||||
|
|
||||||
|
class m160124_235346_add_product_buntetes extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$productCategory = new ProductCategory();
|
||||||
|
$productCategory->name = "Büntetések";
|
||||||
|
$productCategory->status = ProductCategory::STATUS_ACTIVE;
|
||||||
|
|
||||||
|
$productCategory->save(false);
|
||||||
|
|
||||||
|
$product = new Product();
|
||||||
|
$product->name = "Büntetés Szerződés 3000 ft";
|
||||||
|
$product->product_number = "buntetes3000";
|
||||||
|
$product->id_account = 1;
|
||||||
|
$product->purchase_price = 0;
|
||||||
|
$product->sale_price = 3000;
|
||||||
|
$product->id_product_category = $productCategory->id_product_category;
|
||||||
|
$product->save(false);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
28
frontend/assets/TransferUserCartAsset.php
Normal file
28
frontend/assets/TransferUserCartAsset.php
Normal 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 frontend\assets;
|
||||||
|
|
||||||
|
use yii\web\AssetBundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Qiang Xue <qiang.xue@gmail.com>
|
||||||
|
* @since 2.0
|
||||||
|
*/
|
||||||
|
class TransferUserCartAsset extends AssetBundle
|
||||||
|
{
|
||||||
|
public $basePath = '@webroot';
|
||||||
|
public $baseUrl = '@web';
|
||||||
|
public $css = [
|
||||||
|
];
|
||||||
|
public $js = [
|
||||||
|
'js/transfer.usercart.js',
|
||||||
|
];
|
||||||
|
public $depends = [
|
||||||
|
'frontend\assets\AppAsset',
|
||||||
|
];
|
||||||
|
}
|
||||||
284
frontend/controllers/ContractController.php
Normal file
284
frontend/controllers/ContractController.php
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace frontend\controllers;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use common\models\Contract;
|
||||||
|
use frontend\models\ContractSearch;
|
||||||
|
use yii\web\Controller;
|
||||||
|
use yii\web\NotFoundHttpException;
|
||||||
|
use yii\filters\VerbFilter;
|
||||||
|
use common\models\Card;
|
||||||
|
use common\models\TicketInstallmentRequest;
|
||||||
|
use common\models\Ticket;
|
||||||
|
use common\models\Transfer;
|
||||||
|
use common\models\Account;
|
||||||
|
use common\components\Helper;
|
||||||
|
use common\models\Sale;
|
||||||
|
use common\models\Product;
|
||||||
|
use common\models\ShoppingCart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ContractController implements the CRUD actions for Contract model.
|
||||||
|
*/
|
||||||
|
class ContractController extends Controller {
|
||||||
|
public function behaviors() {
|
||||||
|
return [
|
||||||
|
'verbs' => [
|
||||||
|
'class' => VerbFilter::className (),
|
||||||
|
'actions' => [
|
||||||
|
'delete' => [
|
||||||
|
'post'
|
||||||
|
],
|
||||||
|
'payout' => [
|
||||||
|
'post'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all Contract models.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionIndex($id_card) {
|
||||||
|
$card = Card::findOne ( $id_card );
|
||||||
|
|
||||||
|
if (! isset ( $card ))
|
||||||
|
throw new NotFoundHttpException ( 'A bérlet nem található' );
|
||||||
|
|
||||||
|
$searchModel = new ContractSearch ();
|
||||||
|
$searchModel->card = $card;
|
||||||
|
$searchModel->customer = $card->customer;
|
||||||
|
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
|
||||||
|
|
||||||
|
return $this->render ( 'index', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a single Contract model.
|
||||||
|
*
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionView($id) {
|
||||||
|
$model = $this->findModel ( $id );
|
||||||
|
$customer = $model->customer;
|
||||||
|
$card = $customer->card;
|
||||||
|
|
||||||
|
$installments = TicketInstallmentRequest::find ()->andWhere ( [
|
||||||
|
'id_contract' => $model->id_contract
|
||||||
|
] )->orderBy ( [
|
||||||
|
'ticket_installment_request.priority' => SORT_ASC
|
||||||
|
] )->all ();
|
||||||
|
|
||||||
|
return $this->render ( 'view', [
|
||||||
|
'model' => $model,
|
||||||
|
'intstallments' => $installments,
|
||||||
|
'card' => $card
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Contract model.
|
||||||
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionCreate() {
|
||||||
|
$model = new Contract ();
|
||||||
|
|
||||||
|
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
|
||||||
|
return $this->redirect ( [
|
||||||
|
'view',
|
||||||
|
'id' => $model->id_contract
|
||||||
|
] );
|
||||||
|
} else {
|
||||||
|
return $this->render ( 'create', [
|
||||||
|
'model' => $model
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates an existing Contract 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_contract
|
||||||
|
] );
|
||||||
|
} else {
|
||||||
|
return $this->render ( 'update', [
|
||||||
|
'model' => $model
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes an existing Contract 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'
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EGY RÉSZLET KIFIZETÉSE
|
||||||
|
*/
|
||||||
|
public function actionPayout($id) {
|
||||||
|
$part = TicketInstallmentRequest::findOne ( $id );
|
||||||
|
$contract = $part->contract;
|
||||||
|
$customer = $contract->customer;
|
||||||
|
$card = $customer->card;
|
||||||
|
|
||||||
|
$connection = \Yii::$app->db;
|
||||||
|
$transaction = $connection->beginTransaction ();
|
||||||
|
try {
|
||||||
|
|
||||||
|
$result = Transfer::sellContractTicket ( $contract, $part, Account::readDefaultObject (), Transfer::STATUS_NOT_PAID, Transfer::PAYMENT_METHOD_CASH, true );
|
||||||
|
$transfer = $result [0];
|
||||||
|
if ( $part->status != TicketInstallmentRequest::$STATUS_REJECTED ){
|
||||||
|
$contract->part_required = $contract->part_required +1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$contract->part_paid = $contract->part_paid +1;
|
||||||
|
|
||||||
|
if ( $contract->part_paid >= $contract->part_required){
|
||||||
|
$contract->status = Contract::$STATUS_PAID;
|
||||||
|
}else{
|
||||||
|
$contract->status = Contract::$STATUS_NOT_PAID;
|
||||||
|
}
|
||||||
|
|
||||||
|
$contract->save(false);
|
||||||
|
|
||||||
|
$part->status = TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL;
|
||||||
|
$part->id_transfer = $transfer->id_transfer;
|
||||||
|
$part->request_processed_at = Helper::getDateTimeString ();
|
||||||
|
|
||||||
|
$part->save ( false );
|
||||||
|
$transaction->commit ();
|
||||||
|
\Yii::$app->session->setFlash ( 'success', "Részlet a bevásárló kosárba helyezve!" );
|
||||||
|
} catch ( Exception $e ) {
|
||||||
|
$transaction->rollback ();
|
||||||
|
Yii::error ( "Nem sikerült a kifizetés." );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect ( [
|
||||||
|
'view',
|
||||||
|
'id' => $contract->id_contract
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EGY RÉSZLET KIFIZETÉSE
|
||||||
|
*/
|
||||||
|
public function actionCancel($id) {
|
||||||
|
$contract = $this->findModel ( $id );
|
||||||
|
$customer = $contract->customer;
|
||||||
|
$card = $customer->card;
|
||||||
|
|
||||||
|
if ($contract->canCancel ()) {
|
||||||
|
$connection = \Yii::$app->db;
|
||||||
|
$transaction = $connection->beginTransaction ();
|
||||||
|
try {
|
||||||
|
|
||||||
|
$contract->flag = Contract::$FLAG_CANCELED;
|
||||||
|
$contract->save ();
|
||||||
|
$requests = $contract->requests;
|
||||||
|
$buntetes = 0;
|
||||||
|
|
||||||
|
foreach ( $requests as $request ) {
|
||||||
|
/** @var common\models\TicketInstallmentRequest $request*/
|
||||||
|
if ($request->isStatusAccepted ()) {
|
||||||
|
$buntetes = $buntetes + 1;
|
||||||
|
} else {
|
||||||
|
$request->status = TicketInstallmentRequest::$STATUS_CANCELED;
|
||||||
|
$request->save ( false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$productBuntetes = Product::find ()->andWhere ( [
|
||||||
|
'product_number' => Product::$BUNTETES
|
||||||
|
] )->one ();
|
||||||
|
|
||||||
|
if (isset ( $productBuntetes )) {
|
||||||
|
if ($buntetes > 0) {
|
||||||
|
|
||||||
|
$sale = new Sale ();
|
||||||
|
$sale->id_account = Account::readDefault ();
|
||||||
|
$sale->id_product = $productBuntetes->id_product;
|
||||||
|
$sale->status = Sale::STATUS_NOT_PAID;
|
||||||
|
$sale->type = Sale::TYPE_PRODUCT;
|
||||||
|
$sale->item_price = $productBuntetes->sale_price;
|
||||||
|
$sale->count = $buntetes;
|
||||||
|
$sale->money = $buntetes * $sale->item_price;
|
||||||
|
$sale->id_user = \Yii::$app->user->id;
|
||||||
|
|
||||||
|
$sale->save ( false );
|
||||||
|
|
||||||
|
$transfer = Transfer::createProductTransfer ( $sale, Account::readDefaultObject (), null, null, $sale->count, $productBuntetes, Transfer::STATUS_NOT_PAID, $customer );
|
||||||
|
$transfer->payment_method = Transfer::PAYMENT_METHOD_CASH;
|
||||||
|
|
||||||
|
$transfer->id_user = Yii::$app->user->id;
|
||||||
|
|
||||||
|
$transfer->save ( false );
|
||||||
|
|
||||||
|
$cart = new ShoppingCart ();
|
||||||
|
$cart->id_customer = $customer->id_customer;
|
||||||
|
$cart->id_transfer = $transfer->id_transfer;
|
||||||
|
$cart->save ( false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaction->commit ();
|
||||||
|
\Yii::$app->session->setFlash ( 'success', "Szerződés felbontva!" );
|
||||||
|
} catch ( Exception $e ) {
|
||||||
|
$transaction->rollback ();
|
||||||
|
Yii::error ( "Szerződés felbontása nem sikerült!" );
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
\Yii::$app->session->setFlash ( 'danger', "Szerződést nem lehet felbontani!" );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect ( [
|
||||||
|
'view',
|
||||||
|
'id' => $contract->id_contract
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the Contract model based on its primary key value.
|
||||||
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
|
*
|
||||||
|
* @param integer $id
|
||||||
|
* @return Contract the loaded model
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
protected function findModel($id) {
|
||||||
|
if (($model = Contract::findOne ( $id )) !== null) {
|
||||||
|
return $model;
|
||||||
|
} else {
|
||||||
|
throw new NotFoundHttpException ( 'The requested page does not exist.' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -34,7 +34,7 @@ class CustomerController extends Controller
|
|||||||
],
|
],
|
||||||
'access' => [
|
'access' => [
|
||||||
'class' => \yii\filters\AccessControl::className(),
|
'class' => \yii\filters\AccessControl::className(),
|
||||||
'only' => ['create', 'update','reception'],
|
'only' => ['create', 'update','reception','contract'],
|
||||||
'rules' => [
|
'rules' => [
|
||||||
// allow authenticated users
|
// allow authenticated users
|
||||||
[
|
[
|
||||||
@ -199,6 +199,18 @@ class CustomerController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function actionContract($id){
|
||||||
|
$model = $this->findModel($id);
|
||||||
|
|
||||||
|
$mpdf=new \mPDF('utf-8', 'A4-L');
|
||||||
|
$mpdf->WriteHTML($this->renderPartial('_contract', [
|
||||||
|
'model' => $model,
|
||||||
|
]));
|
||||||
|
$mpdf->Output('szerzodes.pdf', 'D');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes an existing Customer model.
|
* Deletes an existing Customer model.
|
||||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
|
|||||||
@ -19,6 +19,7 @@ use common\models\ProductCategory;
|
|||||||
use common\models\Product;
|
use common\models\Product;
|
||||||
use common\models\TransferTicketSearch;
|
use common\models\TransferTicketSearch;
|
||||||
use common\models\TicketType;
|
use common\models\TicketType;
|
||||||
|
use frontend\models\UserCartForm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TransferController implements the CRUD actions for Transfer model.
|
* TransferController implements the CRUD actions for Transfer model.
|
||||||
@ -337,4 +338,15 @@ class TransferController extends Controller
|
|||||||
exit;
|
exit;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function actionUserCart(){
|
||||||
|
|
||||||
|
$model = new UserCartForm();
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->payout()) {
|
||||||
|
return $this->redirect(['user-cart']);
|
||||||
|
}
|
||||||
|
$model->run();
|
||||||
|
return $this->render("usercart",[ 'model' => $model]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
88
frontend/models/ContractSearch.php
Normal file
88
frontend/models/ContractSearch.php
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace frontend\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\Contract;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ContractSearch represents the model behind the search form about `common\models\Contract`.
|
||||||
|
*/
|
||||||
|
class ContractSearch extends Contract
|
||||||
|
{
|
||||||
|
|
||||||
|
public $card;
|
||||||
|
public $customer;
|
||||||
|
|
||||||
|
public $parts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['id_contract', 'id_user', 'id_customer', 'status', 'flag', 'part_paid', 'part_count', 'part_required'], 'integer'],
|
||||||
|
[['expired_at', '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 = Contract::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->andWhere([
|
||||||
|
'id_customer' => $this->customer->id_customer
|
||||||
|
]);
|
||||||
|
|
||||||
|
$query->andFilterWhere([
|
||||||
|
// 'id_contract' => $this->id_contract,
|
||||||
|
// 'id_user' => $this->id_user,
|
||||||
|
// 'id_customer' => $this->id_customer,
|
||||||
|
// 'status' => $this->status,
|
||||||
|
// 'flag' => $this->flag,
|
||||||
|
// 'part_paid' => $this->part_paid,
|
||||||
|
// 'part_count' => $this->part_count,
|
||||||
|
// 'part_required' => $this->part_required,
|
||||||
|
// 'expired_at' => $this->expired_at,
|
||||||
|
// 'created_at' => $this->created_at,
|
||||||
|
// 'updated_at' => $this->updated_at,
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -56,12 +56,17 @@ class KeyToggleForm extends Model
|
|||||||
|
|
||||||
public function assign(){
|
public function assign(){
|
||||||
if ( isset($this->card) && isset($this->customer) ){
|
if ( isset($this->card) && isset($this->customer) ){
|
||||||
$assignment = new CardKeyAssignment();
|
$assignments = CardKeyAssignment::find()->andWhere(['id_card' => $this->card->id_card])->all();
|
||||||
$assignment->id_card = $this->card->id_card;
|
if ( count($assignments) > 0 ){
|
||||||
$assignment->id_key = $this->keyModel->id_key;
|
\Yii::$app->session->setFlash ( 'danger', 'A vendégnél egyszerre csak egy kulcs lehet' );
|
||||||
$assignment->id_user = \Yii::$app->user->id;
|
}else{
|
||||||
$assignment->save(false);
|
$assignment = new CardKeyAssignment();
|
||||||
\Yii::$app->session->setFlash ( 'success', 'Kulcs kiadva!' );
|
$assignment->id_card = $this->card->id_card;
|
||||||
|
$assignment->id_key = $this->keyModel->id_key;
|
||||||
|
$assignment->id_user = \Yii::$app->user->id;
|
||||||
|
$assignment->save(false);
|
||||||
|
\Yii::$app->session->setFlash ( 'success', 'Kulcs kiadva!' );
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
\Yii::$app->session->setFlash ( 'danger', 'Nincs vendég kiválasztva vagy érvénytelen kártya!' );
|
\Yii::$app->session->setFlash ( 'danger', 'Nincs vendég kiválasztva vagy érvénytelen kártya!' );
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,8 @@ use common\models\CardSearch;
|
|||||||
use common\models\AccountState;
|
use common\models\AccountState;
|
||||||
use common\models\Key;
|
use common\models\Key;
|
||||||
use common\models\CardKeyAssignment;
|
use common\models\CardKeyAssignment;
|
||||||
|
use common\models\Contract;
|
||||||
|
use yii\db\Expression;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ContactForm is the model behind the contact form.
|
* ContactForm is the model behind the contact form.
|
||||||
@ -26,6 +28,7 @@ class ReceptionForm extends Model
|
|||||||
public $cardSearchModel;
|
public $cardSearchModel;
|
||||||
public $lastCassaState;
|
public $lastCassaState;
|
||||||
public $keys;
|
public $keys;
|
||||||
|
public $contract;
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
@ -73,6 +76,7 @@ class ReceptionForm extends Model
|
|||||||
$this->customer = $this->card->customer;
|
$this->customer = $this->card->customer;
|
||||||
$this->readValidTickets();
|
$this->readValidTickets();
|
||||||
$this->readAssignedKeys();
|
$this->readAssignedKeys();
|
||||||
|
$this->readContract();
|
||||||
}
|
}
|
||||||
|
|
||||||
$defaultAccount = Account::readDefault();
|
$defaultAccount = Account::readDefault();
|
||||||
@ -104,6 +108,18 @@ class ReceptionForm extends Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function readContract(){
|
||||||
|
if ($this->isCardWithCustomer()){
|
||||||
|
|
||||||
|
$query = Contract::find();
|
||||||
|
$query->andWhere(['id_customer' => $this->customer->id_customer ]);
|
||||||
|
$query->andWhere([ '>=' ,'expired_at' , new Expression("now()") ]);
|
||||||
|
$query->andWhere(["not in" , 'flag' , [Contract::$FLAG_DELETED, Contract::$FLAG_CANCELED]]);
|
||||||
|
$this->contract = $query->one();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function hasCassa(){
|
public function hasCassa(){
|
||||||
return isset($this->lastCassaState) ;
|
return isset($this->lastCassaState) ;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,8 @@ use common\models\UserSoldItem;
|
|||||||
use common\models\ShoppingCart;
|
use common\models\ShoppingCart;
|
||||||
use yii\base\Object;
|
use yii\base\Object;
|
||||||
use common\models\TicketInstallmentRequest;
|
use common\models\TicketInstallmentRequest;
|
||||||
|
use common\models\Contract;
|
||||||
|
use common\components\Helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property $cart string name of cart, into we put the ticket
|
* @property $cart string name of cart, into we put the ticket
|
||||||
@ -103,6 +105,17 @@ class TicketCreate extends Ticket{
|
|||||||
$this->addError($attribute,"Vendég bankszámlaszáma nem 16 vagy 24 hosszú");
|
$this->addError($attribute,"Vendég bankszámlaszáma nem 16 vagy 24 hosszú");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//find
|
||||||
|
$query = Contract::find();
|
||||||
|
$query->andWhere( [ 'id_customer' => $this->customer->id_customer ]);
|
||||||
|
$query->andWhere( [ '>', 'expired_at' , Helper::getDateTimeString() ]);
|
||||||
|
$query->andWhere( [ 'not in', 'flag', [Contract::$FLAG_DELETED ] ]);
|
||||||
|
$contracts = $query->all();
|
||||||
|
|
||||||
|
if ( count($contracts) > 0 ){
|
||||||
|
$this->addError($attribute,"A vendégnek már van érvényes vagy felbontott szerződése!");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,15 +155,28 @@ class TicketCreate extends Ticket{
|
|||||||
$this->addTransfer();
|
$this->addTransfer();
|
||||||
$this->appendToUserCart();
|
$this->appendToUserCart();
|
||||||
$this->appendToCustomerCart();
|
$this->appendToCustomerCart();
|
||||||
$this->addTicketInstallmentRequests($insert);
|
$this->addContract($insert);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addTicketInstallmentRequests($insert){
|
public function addContract($insert){
|
||||||
if ($insert){
|
if ($insert){
|
||||||
$ticketType = TicketType::findOne($this->id_ticket_type);
|
$ticketType = TicketType::findOne($this->id_ticket_type);
|
||||||
if ( isset($ticketType) && $ticketType->isInstallment() ){
|
if ( isset($ticketType) && $ticketType->isInstallment() ){
|
||||||
$requests = TicketInstallmentRequest::createInstallments($this, $ticketType, $this->customer);
|
|
||||||
|
$contract = new Contract();
|
||||||
|
$contract->id_customer = $this->customer->id_customer;
|
||||||
|
$contract->id_user = \Yii::$app->user->id;
|
||||||
|
$contract->status = Contract::$STATUS_PAID;
|
||||||
|
$contract->flag = Contract::$FLAG_ACTIVE;
|
||||||
|
$contract->part_count = $ticketType->installment_count;
|
||||||
|
$contract->part_paid = 0;
|
||||||
|
$contract->part_required = 0;
|
||||||
|
$contract->expired_at = date('Y-m-d', strtotime("today +12 month -1 day"));
|
||||||
|
$contract->id_ticket_type = $this->id_ticket_type;
|
||||||
|
$contract->save();
|
||||||
|
|
||||||
|
$requests = TicketInstallmentRequest::createInstallments($this, $ticketType, $this->customer,$contract);
|
||||||
foreach ($requests as $request){
|
foreach ($requests as $request){
|
||||||
$request->save(false);
|
$request->save(false);
|
||||||
}
|
}
|
||||||
|
|||||||
103
frontend/models/UserCartForm.php
Normal file
103
frontend/models/UserCartForm.php
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace frontend\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use common\models\Transfer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ContactForm is the model behind the contact form.
|
||||||
|
*/
|
||||||
|
class UserCartForm extends Model
|
||||||
|
{
|
||||||
|
|
||||||
|
public $items = [];
|
||||||
|
public $transfers;
|
||||||
|
public $payment_method;
|
||||||
|
public $money = 0;
|
||||||
|
public $selected = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['selected', 'each', 'rule' => ['integer']],
|
||||||
|
[['money' ,'payment_method'],'integer'],
|
||||||
|
[['payment_method'],'validatePaymentMethod'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function validatePaymentMethod( $attribute, $params ){
|
||||||
|
if ( !empty($this->payment_method)){
|
||||||
|
// echo $this->payment_method;
|
||||||
|
$arr = Transfer::paymentMethods();
|
||||||
|
if ( !array_key_exists($this->payment_method, $arr) ){
|
||||||
|
$this->addError($attribute, "Érvénytelen fizetési mód");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function payout(){
|
||||||
|
$valid = $this->validate();
|
||||||
|
|
||||||
|
if ( !$valid ){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset($this->selected) && count($this->selected) > 0 ){
|
||||||
|
$items = $this->loadTransfers($this->selected);
|
||||||
|
if ( count($items) == count($this->selected) ){
|
||||||
|
foreach ($items as $item){
|
||||||
|
$this->changePaymentMethod($item);
|
||||||
|
$item->payout();
|
||||||
|
}
|
||||||
|
\Yii::$app->session->setFlash('success', 'Kifizetve');
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
\Yii::$app->session->setFlash('danger', 'Időközben változtak a kosrában található tételek');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
\Yii::$app->session->setFlash('danger', 'Nem választott ki terméket');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function changePaymentMethod($item){
|
||||||
|
if ( !empty($this->payment_method)){
|
||||||
|
$item->payment_method = $this->payment_method;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(){
|
||||||
|
$this->readTransfers();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function readTransfers( ) {
|
||||||
|
$this->transfers = $this->loadTransfers();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadTransfers($id_tranfer_array = null){
|
||||||
|
$query = Transfer::find();
|
||||||
|
$query->innerJoin("user_sold_item", "user_sold_item.id_transfer = transfer.id_transfer");
|
||||||
|
$query->andWhere(["user_sold_item.id_user" => \Yii::$app->user->id]);
|
||||||
|
if (isset($id_tranfer_array)){
|
||||||
|
$query->andWhere(["in", "transfer.id_transfer" , $id_tranfer_array ]);
|
||||||
|
}
|
||||||
|
return $query->all();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -45,7 +45,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
|
|
||||||
|
|
||||||
['class' => 'yii\grid\ActionColumn',
|
['class' => 'yii\grid\ActionColumn',
|
||||||
'template' => '{ticket} {ticket_history} {keys}',
|
'template' => '{ticket} {ticket_history} {keys} {contract}',
|
||||||
'buttons' => [
|
'buttons' => [
|
||||||
'ticket' => function ($url, $model, $key) {
|
'ticket' => function ($url, $model, $key) {
|
||||||
return Html::a('Új bérlet', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
return Html::a('Új bérlet', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
||||||
@ -56,6 +56,9 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
'keys' => function ($url, $model, $key) {
|
'keys' => function ($url, $model, $key) {
|
||||||
return Html::a('Kulcsok', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
return Html::a('Kulcsok', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
||||||
},
|
},
|
||||||
|
'contract' => function ($url, $model, $key) {
|
||||||
|
return Html::a('Szerződések', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
||||||
|
},
|
||||||
],
|
],
|
||||||
'urlCreator' => function ($action, $model, $key, $index){
|
'urlCreator' => function ($action, $model, $key, $index){
|
||||||
$url = "";
|
$url = "";
|
||||||
@ -65,6 +68,8 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
$url = Url::to(['ticket/index','number' => $model['card_number']]);
|
$url = Url::to(['ticket/index','number' => $model['card_number']]);
|
||||||
}else if ( 'keys' == $action ){
|
}else if ( 'keys' == $action ){
|
||||||
$url = Url::to(['key/index','id_card' => $model['card_id_card']]);
|
$url = Url::to(['key/index','id_card' => $model['card_id_card']]);
|
||||||
|
}else if ( 'contract' == $action ){
|
||||||
|
$url = Url::to(['contract/index','id_card' => $model['card_id_card']]);
|
||||||
}
|
}
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,6 +54,20 @@ $card = $model->card;
|
|||||||
<?php echo HtmlHelper::mkReceptionBtn($model, Yii::t( 'frontend/transfer', 'Termékeladás'), 'product/sale')?>
|
<?php echo HtmlHelper::mkReceptionBtn($model, Yii::t( 'frontend/transfer', 'Termékeladás'), 'product/sale')?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ( $model->isCustomerWithTicket() ){
|
||||||
|
?>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-12'>
|
||||||
|
<?php echo Html::a( "Éves szerződés letöltése", [ 'customer/contract' , 'id' => $model->customer->id_customer ]);?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-12'>
|
<div class='col-md-12'>
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ use yii\base\Object;
|
|||||||
use common\models\Ticket;
|
use common\models\Ticket;
|
||||||
use frontend\model\ReceptionForm;
|
use frontend\model\ReceptionForm;
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model frontend\model\ReceptionForm */
|
/* @var $model frontend\model\ReceptionForm */
|
||||||
@ -57,4 +58,23 @@ if ( isset($model->card)){
|
|||||||
echo Html::endTag("div");
|
echo Html::endTag("div");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( isset($model->contract)){
|
||||||
|
if ( $model->contract->isStatusNotPaid() ){
|
||||||
|
echo Html::beginTag("div",['class'=>"alert alert-danger", "role"=>"alert"]);
|
||||||
|
echo Html::beginTag("strong",[ ]);
|
||||||
|
echo "Szerződés részlete nincs fizetve!";
|
||||||
|
echo Html::a("Szerződés részletei",Url::toRoute(['contract/view','id' => $model->contract->id_contract]));
|
||||||
|
echo Html::endTag("strong");
|
||||||
|
echo Html::endTag("div");
|
||||||
|
}else{
|
||||||
|
echo Html::beginTag("div",['class'=>"alert alert-success", "role"=>"alert"]);
|
||||||
|
echo Html::beginTag("strong",[ ]);
|
||||||
|
echo "Érvényes szerződés!";
|
||||||
|
echo Html::a("Szerződés részletei",Url::toRoute(['contract/view','id' => $model->contract->id_contract]));
|
||||||
|
echo Html::endTag("strong");
|
||||||
|
echo Html::endTag("div");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
43
frontend/views/contract/_form.php
Normal file
43
frontend/views/contract/_form.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Contract */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="contract-form">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'id_contract')->textInput() ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'id_user')->textInput() ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'id_customer')->textInput() ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'status')->textInput() ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'flag')->textInput() ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'part_paid')->textInput() ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'part_count')->textInput() ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'part_required')->textInput() ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'expired_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/contract', 'Create') : Yii::t('common/contract', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
47
frontend/views/contract/_search.php
Normal file
47
frontend/views/contract/_search.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model frontend\models\ContractSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="contract-search">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['index'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'id_contract') ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'id_user') ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'id_customer') ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'status') ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'flag') ?>
|
||||||
|
|
||||||
|
<?php // echo $form->field($model, 'part_paid') ?>
|
||||||
|
|
||||||
|
<?php // echo $form->field($model, 'part_count') ?>
|
||||||
|
|
||||||
|
<?php // echo $form->field($model, 'part_required') ?>
|
||||||
|
|
||||||
|
<?php // echo $form->field($model, 'expired_at') ?>
|
||||||
|
|
||||||
|
<?php // echo $form->field($model, 'created_at') ?>
|
||||||
|
|
||||||
|
<?php // echo $form->field($model, 'updated_at') ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton(Yii::t('common/contract', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
<?= Html::resetButton(Yii::t('common/contract', 'Reset'), ['class' => 'btn btn-default']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
21
frontend/views/contract/create.php
Normal file
21
frontend/views/contract/create.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Contract */
|
||||||
|
|
||||||
|
$this->title = Yii::t('common/contract', 'Create Contract');
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/contract', 'Contracts'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="contract-create">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
58
frontend/views/contract/index.php
Normal file
58
frontend/views/contract/index.php
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel frontend\models\ContractSearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = $searchModel->customer->name . " szerződései";
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="contract-index">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
|
||||||
|
<?= GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'columns' => [
|
||||||
|
'id_contract',
|
||||||
|
[
|
||||||
|
'attribute' => 'id_customer',
|
||||||
|
'value' => 'customerName'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'id_user',
|
||||||
|
'value' => 'userName'
|
||||||
|
],
|
||||||
|
// 'part_paid',
|
||||||
|
// 'part_count',
|
||||||
|
// 'part_required',
|
||||||
|
'expired_at:datetime',
|
||||||
|
'created_at:datetime',
|
||||||
|
// 'updated_at',
|
||||||
|
|
||||||
|
['class' => 'yii\grid\ActionColumn',
|
||||||
|
'template' => '{details}',
|
||||||
|
'buttons' => [
|
||||||
|
'details' => function ($url, $model, $key) {
|
||||||
|
return Html::a('Fizetési részletek', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'urlCreator' => function ($action, $model, $key, $index){
|
||||||
|
$url = "";
|
||||||
|
if ( 'details' == $action ){
|
||||||
|
$url = Url::to(['contract/view','id' => $model->id_contract]);
|
||||||
|
}
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
23
frontend/views/contract/update.php
Normal file
23
frontend/views/contract/update.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Contract */
|
||||||
|
|
||||||
|
$this->title = Yii::t('common/contract', 'Update {modelClass}: ', [
|
||||||
|
'modelClass' => 'Contract',
|
||||||
|
]) . ' ' . $model->id_contract;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/contract', 'Contracts'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => $model->id_contract, 'url' => ['view', 'id' => $model->id_contract]];
|
||||||
|
$this->params['breadcrumbs'][] = Yii::t('common/contract', 'Update');
|
||||||
|
?>
|
||||||
|
<div class="contract-update">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
99
frontend/views/contract/view.php
Normal file
99
frontend/views/contract/view.php
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\DetailView;
|
||||||
|
use common\models\TicketInstallmentRequest;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Contract */
|
||||||
|
|
||||||
|
$this->title = $model->id_contract;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/contract', 'Szerződések'), 'url' => ['index', 'id_card' => $card->id_card]];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="contract-view">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
|
||||||
|
<?= DetailView::widget([
|
||||||
|
'model' => $model,
|
||||||
|
'attributes' => [
|
||||||
|
'id_contract',
|
||||||
|
[
|
||||||
|
'attribute' => 'id_user',
|
||||||
|
'value' => $model->userName
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'id_customer',
|
||||||
|
'value' => $model->customerName
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'flag',
|
||||||
|
'value' => $model->flagName
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'status',
|
||||||
|
'value' => $model->statusName
|
||||||
|
],
|
||||||
|
'part_paid',
|
||||||
|
'part_required',
|
||||||
|
'part_count',
|
||||||
|
'expired_at:datetime',
|
||||||
|
'created_at:datetime',
|
||||||
|
],
|
||||||
|
]) ?>
|
||||||
|
<?php if ( $model->canCancel() ){?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<?php
|
||||||
|
echo Html::a("Szerződés felbontása ",['contract/cancel' , 'id' => $model->id_contract], [ 'data-method' => 'post', 'class' => 'btn btn-danger']);
|
||||||
|
?>
|
||||||
|
Szerződés felbontása esetén a már megkezdett hónapokra hónaponként 3000 Ft büntetést írunk fel a vásárló kosarába
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<?php }?>
|
||||||
|
<?php foreach ($intstallments as $inst) {?>
|
||||||
|
<?php
|
||||||
|
/** @var common\models\TicketInstallmentRequest $inst */
|
||||||
|
$panelClass = 'panel-info';
|
||||||
|
if ( $inst->isStatusAccepted() ){
|
||||||
|
$panelClass = "panel-success";
|
||||||
|
}else if ( $inst->isStatusRejected() ){
|
||||||
|
$panelClass = "panel-danger";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="panel panel-default <?php echo $panelClass?>">
|
||||||
|
<div class="panel-heading">Bérlet <?php echo $inst->priority?></div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<tr>
|
||||||
|
<td>Esedékességi dátum</td>
|
||||||
|
<td><?php echo \Yii::$app->formatter->asDate($inst->request_target_time_at)?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Fizetendő</td>
|
||||||
|
<td><?php echo ($inst->money)?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Státusz</td>
|
||||||
|
<td><?php echo ($inst->statusName)?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Bérlet vége</td>
|
||||||
|
<td><?php echo \Yii::$app->formatter->asDate($inst->ticketExpirationDate)?></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ( $inst->isStatusPending() || $inst->isStatusRejected() ){
|
||||||
|
echo Html::a("Fizetettnek jelölés és bérlet vásárló kásrba helyezése",['contract/payout' , 'id' => $inst->id_ticket_installment_request], [ 'data-method' => 'post', 'class' => 'btn btn-danger']);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php }?>
|
||||||
|
|
||||||
|
</div>
|
||||||
24
frontend/views/customer/_contract.php
Normal file
24
frontend/views/customer/_contract.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<h1>
|
||||||
|
Éves szerződés
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Ez az éves szerződés szövege
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Kövektező bekezdés
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
A szerződő fél neve:
|
||||||
|
<span>
|
||||||
|
<?php
|
||||||
|
echo $model->name
|
||||||
|
?>
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<span>A cég neve:</span>
|
||||||
|
<span><?php echo \Yii::$app->params['company_name']?></span>
|
||||||
|
</p>
|
||||||
@ -44,4 +44,7 @@ use kartik\widgets\ActiveForm;
|
|||||||
<div class='col-md-3 '>
|
<div class='col-md-3 '>
|
||||||
<?php echo Html::a(Yii::t('frontend/product', "Frissít"),null,[ 'class' => 'btn btn-primary btn-block' , 'onclick' => 'location.reload();']) ?>
|
<?php echo Html::a(Yii::t('frontend/product', "Frissít"),null,[ 'class' => 'btn btn-primary btn-block' , 'onclick' => 'location.reload();']) ?>
|
||||||
</div>
|
</div>
|
||||||
|
<div class='col-md-3 '>
|
||||||
|
<?php echo Html::a(Yii::t('transfer/user-cart', "Kosár részletei"),['transfer/user-cart'],[ 'class' => 'btn btn-primary btn-block' ]) ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -101,6 +101,7 @@ td,th{
|
|||||||
<tr>
|
<tr>
|
||||||
<th>T</th>
|
<th>T</th>
|
||||||
<th>Kiadva</th>
|
<th>Kiadva</th>
|
||||||
|
<th>F. mód</th>
|
||||||
<th>Fizetve</th>
|
<th>Fizetve</th>
|
||||||
<th>Kassza</th>
|
<th>Kassza</th>
|
||||||
<th>Felhasználó</th>
|
<th>Felhasználó</th>
|
||||||
@ -117,6 +118,7 @@ td,th{
|
|||||||
<tr>
|
<tr>
|
||||||
<td><?php echo "#".$p['id_transfer']?> </td>
|
<td><?php echo "#".$p['id_transfer']?> </td>
|
||||||
<td><?php echo $p['product_created_at']?> </td>
|
<td><?php echo $p['product_created_at']?> </td>
|
||||||
|
<td><?php echo Transfer::toPaymentMethodName( $p['transfer_payment_method'] )?> </td>
|
||||||
<td><?php echo $p['product_paid_at']?> </td>
|
<td><?php echo $p['product_paid_at']?> </td>
|
||||||
<td><?php echo $p['account_name']?> </td>
|
<td><?php echo $p['account_name']?> </td>
|
||||||
<td><?php echo $p['user_name']?> </td>
|
<td><?php echo $p['user_name']?> </td>
|
||||||
|
|||||||
13
frontend/views/transfer/_user_cart_item.php
Normal file
13
frontend/views/transfer/_user_cart_item.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md4">
|
||||||
|
<?php echo $model->objectName;?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md4">
|
||||||
|
<?php echo $model->transferTypeName;?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -3,6 +3,7 @@ use yii\helpers\Html;
|
|||||||
use yii\grid\GridView;
|
use yii\grid\GridView;
|
||||||
use yii\widgets\ListView;
|
use yii\widgets\ListView;
|
||||||
use yii\base\Widget;
|
use yii\base\Widget;
|
||||||
|
use common\models\Transfer;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $searchModel common\models\TransferSearch */
|
/* @var $searchModel common\models\TransferSearch */
|
||||||
@ -66,8 +67,9 @@ td.name {
|
|||||||
<table class="table table-bordered table-striped table-summary">
|
<table class="table table-bordered table-striped table-summary">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Tranzakció</th>
|
<th>ID</th>
|
||||||
<th>Kiadva</th>
|
<th>Kiadva</th>
|
||||||
|
<th>F. mód</th>
|
||||||
<th>Fizetve</th>
|
<th>Fizetve</th>
|
||||||
<th>Kassza</th>
|
<th>Kassza</th>
|
||||||
<th>Felhasználó</th>
|
<th>Felhasználó</th>
|
||||||
@ -84,6 +86,7 @@ td.name {
|
|||||||
<tr>
|
<tr>
|
||||||
<td><?php echo "#".$p['id_transfer']?> </td>
|
<td><?php echo "#".$p['id_transfer']?> </td>
|
||||||
<td><?php echo ( $p['product_created_at'])?> </td>
|
<td><?php echo ( $p['product_created_at'])?> </td>
|
||||||
|
<td><?php echo Transfer::toPaymentMethodName( $p['transfer_payment_method'] )?> </td>
|
||||||
<td><?php echo $p['product_paid_at']?> </td>
|
<td><?php echo $p['product_paid_at']?> </td>
|
||||||
<td><?php echo $p['account_name']?> </td>
|
<td><?php echo $p['account_name']?> </td>
|
||||||
<td><?php echo $p['user_name']?> </td>
|
<td><?php echo $p['user_name']?> </td>
|
||||||
|
|||||||
90
frontend/views/transfer/usercart.php
Normal file
90
frontend/views/transfer/usercart.php
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
use yii\data\ArrayDataProvider;
|
||||||
|
use yii\widgets\ListView;
|
||||||
|
use yii\base\Widget;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use common\models\Transfer;
|
||||||
|
use yii\grid\CheckboxColumn;
|
||||||
|
use frontend\assets\TransferUserCartAsset;
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
TransferUserCartAsset::register($this);
|
||||||
|
|
||||||
|
$options = [];
|
||||||
|
|
||||||
|
$this->registerJs ( 'new TransferUserCart( '. json_encode($options).');' );
|
||||||
|
$dp = new ArrayDataProvider(
|
||||||
|
[
|
||||||
|
'allModels' => $model->transfers,
|
||||||
|
'pagination' => false
|
||||||
|
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<h1>Kosár</h1>
|
||||||
|
<div class="transfer-form">
|
||||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
<?php echo $form->field($model, 'payment_method')->dropDownList( ['' => 'Aktuális'] + Transfer::paymentMethods())->label("Fizetése mód") ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<span>Összesen:</span>
|
||||||
|
<span class="selected-money"><?php echo $model->money ?></span>
|
||||||
|
<span> Ft</span>
|
||||||
|
<?php echo $form->field($model, "money" , [ ])->hiddenInput(); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$formModel = $model;
|
||||||
|
|
||||||
|
echo GridView::widget([
|
||||||
|
"dataProvider" => $dp,
|
||||||
|
'columns' =>[
|
||||||
|
[
|
||||||
|
'label' => '',
|
||||||
|
'value' => function ($model, $key, $index, $column) use (&$form, &$formModel){
|
||||||
|
|
||||||
|
return Html::checkbox(Html::getInputName($formModel, 'selected[]') , in_array($model->id_transfer, $formModel->selected) , [ 'data-money' => $model->money, 'class' => 'cart-item', 'value' => $model->id_transfer] );
|
||||||
|
},
|
||||||
|
'format' => 'raw'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'value' => 'transferTypeName',
|
||||||
|
'label' => 'Típus'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'value' => 'objectName',
|
||||||
|
'label' => 'Megnevezés'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'value' => 'item_price',
|
||||||
|
'label' => 'Egység ár'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'value' => 'count',
|
||||||
|
'label' => 'Mennyiség'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'value' => 'money',
|
||||||
|
'label' => 'Összesen'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'value' => 'paymentMethodName',
|
||||||
|
'label' => 'Fizetési mód'
|
||||||
|
],
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton( "Kiválasztott elemek fizetve", ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
</div>
|
||||||
26
frontend/web/js/transfer.usercart.js
Normal file
26
frontend/web/js/transfer.usercart.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
function TransferUserCart(o){
|
||||||
|
|
||||||
|
var defaults = {};
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
function init(){
|
||||||
|
defaults = $.extend(defaults,o);
|
||||||
|
$('.select-on-check-all').click(recalculate);
|
||||||
|
$('.cart-item').click(recalculate);
|
||||||
|
}
|
||||||
|
|
||||||
|
function recalculate(){
|
||||||
|
var items = $('.cart-item');
|
||||||
|
var money = 0;
|
||||||
|
items.each(function(i,e){
|
||||||
|
if ( $(e).is(':checked')){
|
||||||
|
money += $(e).data('money');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#usercartform-money').val(money);
|
||||||
|
$('.selected-money').html(money);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user