diff --git a/backend/views/ticket/index.php b/backend/views/ticket/index.php
index 5121848..d0bb127 100644
--- a/backend/views/ticket/index.php
+++ b/backend/views/ticket/index.php
@@ -104,6 +104,10 @@ $this->params['breadcrumbs'][] = $this->title;
'attribute' => 'id_account',
'value' => 'accountName'
],
+ [
+ 'attribute' => 'status',
+ 'value' => 'statusName'
+ ],
// 'max_usage_count',
// 'usage_count',
diff --git a/backend/views/ticket/view.php b/backend/views/ticket/view.php
index 2cf4115..5a6e79e 100644
--- a/backend/views/ticket/view.php
+++ b/backend/views/ticket/view.php
@@ -19,17 +19,36 @@ $this->params['breadcrumbs'][] = $this->title;
'model' => $model,
'attributes' => [
'id_ticket',
- 'id_user',
- 'id_ticket_type',
- 'id_account',
- 'id_discount',
- 'start',
- 'end',
+ [
+ 'attribute' => 'id_user',
+ 'value' => $model->user->username,
+
+ ],
+ [
+ 'attribute' => 'id_ticket_type',
+ 'value' => $model->ticketTypeName,
+
+ ],
+ [
+ 'attribute' => 'id_account',
+ 'value' => $model->accountName,
+
+ ],
+ [
+ 'attribute' => 'id_discount',
+ 'value' => $model->discountName,
+
+ ],
+ 'start:datetime',
+ 'end:datetime',
'max_usage_count',
'usage_count',
- 'status',
+ [
+ 'attribute' => 'status',
+ 'value' => $model->statusName
+ ],
'price_brutto',
- 'comment',
+ 'comment:raw',
'created_at',
'updated_at',
],
diff --git a/backend/views/ugiro/detsta.php b/backend/views/ugiro/detsta.php
new file mode 100644
index 0000000..dc9a242
--- /dev/null
+++ b/backend/views/ugiro/detsta.php
@@ -0,0 +1,26 @@
+
+
+detsta
+
+koteg->id_ugiro;
+ $model->run();
+
+ $megbizasok = $model->megbizasok;
+
+ echo "
Megbízások száma:". count($megbizasok);
+
+ foreach ($megbizasok as $m){
+ echo "
". $m->id_ticket_installment_request . " - " . ($m->detstaTetel->toString());
+ }
+
+ echo "
" . nl2br( $model->detstatUzenet->toString());
+
+
+ print_r($model->errors);
+
+?>
\ No newline at end of file
diff --git a/backend/views/ugiro/upload.php b/backend/views/ugiro/upload.php
new file mode 100644
index 0000000..e42779c
--- /dev/null
+++ b/backend/views/ugiro/upload.php
@@ -0,0 +1,27 @@
+
+
+
DetSta Fájl Feltöltés
+
+ Ezen a felületen csak a fájl feltöltés törénik meg, a fájl feldolgozása a köteg nézet-ben lehetséges
+
+
diff --git a/backend/views/ugiro/view.php b/backend/views/ugiro/view.php
index 047dd47..f3904e1 100644
--- a/backend/views/ugiro/view.php
+++ b/backend/views/ugiro/view.php
@@ -4,6 +4,7 @@ use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\helpers\Url;
use common\models\Ugiro;
+use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Ugiro */
@@ -12,17 +13,33 @@ $this->title = "Köteg részletei";
$this->params['breadcrumbs'][] = ['label' => "Kötegek", 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
+
= Html::encode($this->title) ?>
-
'id_ugiro',
'label' => 'Köteg azonosító'
],
+ [
+ 'attribute' => 'number',
+ 'label' => 'Üzenet sorszám'
+ ],
+ [
+ 'attribute' => 'datum',
+ 'label' => 'Üzenet összeállítási dátum'
+ ],
[
'attribute' => 'user.username',
'label' => 'Felhasználó'
@@ -38,13 +55,21 @@ $attributes = [
],
[
'attribute' => 'path',
- 'label' => 'Köteg Fájl',
+ 'label' => 'Beszed Fájl',
'value' => Html::a( "Letöltés" , Url::base() ."/". $model->path , ['target' =>'_blank' ,'download' =>'CS-BESZED.' .$model->id_ugiro ] ),
'format' => 'raw'
],
];
- if ( $model->status == Ugiro::$STATUS_FINISHED){
-
+
+
+
+ if ( $model->status == Ugiro::$STATUS_RECIEVED || $model->status == Ugiro::$STATUS_FINISHED ){
+ $attributes[] = [
+ 'attribute' => 'desta_path',
+ 'label' => 'Detsta Fájl',
+ 'value' => Html::a( "Letöltés" , Url::base() ."/". $model->desta_path , ['target' =>'_blank' ,'download' =>'CS-BESZED.' .$model->id_ugiro ] ),
+ 'format' => 'raw'
+ ];
}
?>
@@ -56,3 +81,13 @@ $attributes = [
]) ?>
+
+status == Ugiro::$STATUS_RECIEVED ){
+ echo Html::a("DetSta Fájl Feldoglozás",['view', 'id' => $model->id_ugiro] ,['data-method' =>'post', 'class' => 'btn btn-danger']);
+ }
+ echo Html::a("Megbízások a kötegben",['ticket-installment-request/index', 'TicketInstallmentRequestSearch[id_ugiro]' => $model->id_ugiro] ,[ 'class' => 'btn btn-primary']);
+?>
+
+
+
diff --git a/backend/web/giro/megbizas/.gitkeep b/backend/web/giro/megbizas/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/backend/web/giro/valasz/.gitkeep b/backend/web/giro/valasz/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/common/components/DetStatProcessor.php b/common/components/DetStatProcessor.php
new file mode 100644
index 0000000..e9141fa
--- /dev/null
+++ b/common/components/DetStatProcessor.php
@@ -0,0 +1,137 @@
+readKoteg();
+ $this->readKotegMegbizasok();
+ $this->readDetstaUzenet();
+ $this->createMegbizasTetelHozzarendelesek();
+ $this->processMegbizasok();
+ $this->markKotegFinished();
+ }
+
+ public function markKotegFinished(){
+ $this->koteg->status = Ugiro::$STATUS_FINISHED;
+ $this->koteg->save();
+ }
+
+ public function processMegbizasok(){
+ foreach ($this->megbizasok as $megbizas){
+ $processor = new DetStatTetelProcessor(
+ [
+ 'tetel' => $megbizas->detstaTetel,
+ 'megbizas' => $megbizas
+ ]
+ );
+ $processor->run();
+ $this->errors = $this->errors + $processor->errors;
+ }
+ }
+
+ public function readDetstaUzenet(){
+
+ $filename = \Yii::getAlias("@webroot") ."/" .$this->koteg->desta_path;
+ $content = file_get_contents($filename);
+ $this->detstatUzenet = GiroDETSTA::parse($content);
+
+
+
+
+ $this->detstatUzenet = new GiroDETSTA();
+ $this->idKoteg = 33;
+
+ $fej = new GiroDETSTAFej();
+
+ $this->detstatUzenet->fej = $fej;
+
+ $tetel = new GiroDETSTATetel();
+ $tetel->ugyfelAzonosito = 12;
+ $tetel->visszajelzesInformacio = "00";
+ $tetel->visszajelzesInformacio = "02";
+
+ $this->detstatUzenet->tetelek[] = $tetel;
+
+ $lab = new GiroDETSTALab();
+ $this->detstatUzenet->lab = $lab;
+
+ }
+
+ public function createMegbizasTetelHozzarendelesek(){
+ $mapTetel = [];
+ foreach ($this->detstatUzenet->tetelek as $tetel ){
+ $mapTetel[$tetel->ugyfelAzonosito] = $tetel;
+ }
+
+ foreach ($this->megbizasok as $megbizas){
+ if ( array_key_exists($megbizas->id_ticket_installment_request, $mapTetel)){
+ $megbizas->detstaTetel = $mapTetel[$megbizas->id_ticket_installment_request];
+ }
+ }
+
+
+ }
+
+
+ public function readKoteg(){
+ $this->koteg = Ugiro::findOne($this->idKoteg );
+ if ( !isset($this->koteg) ){
+ $this->errors [] = "Kötege nem található! (".$this->detstatUzenet->fej." )";
+ }
+ }
+ public function readKotegMegbizasok(){
+ $this->megbizasok = $this->koteg->requests;
+ }
+
+ public function applyNewMegbizasState(){
+ $kod = $this->tetel->valaszHivatkozasiKod;
+
+ if ( $kod == GiroDETSTATetel::$INFORMACIO_TELJESITETT){
+ $this->megbizas->status = TicketInstallmentRequest::$STATUS_ACCEPTED;
+ }else{
+ $this->megbizas->status = TicketInstallmentRequest::$STATUS_REJECTED;
+ }
+ $this->megbizas->save(false);
+ }
+
+ public function applyNewTicketState(){
+ $this->ticket->applyTicketInstallmentRequest($this->megbizas);
+ $this->ticket->save(false);
+ }
+
+
+ public function hasError(){
+ return count($this->errors) > 0;
+ }
+
+
+}
\ No newline at end of file
diff --git a/common/components/DetStatTetelProcessor.php b/common/components/DetStatTetelProcessor.php
new file mode 100644
index 0000000..e986bb3
--- /dev/null
+++ b/common/components/DetStatTetelProcessor.php
@@ -0,0 +1,129 @@
+readMegbizas();
+ if ($this->megbizas->isStatusAccepted()) {
+// return;
+ }
+ $status = TicketInstallmentRequest::$STATUS_REJECTED;
+ $kod = 'xx';
+ $comment = "";
+ if (isset ( $this->tetel )) {
+ $kod = $this->tetel->visszajelzesInformacio;
+ }
+
+ if ($kod == GiroDETSTATetel::$INFORMACIO_TELJESITETT) {
+ $status = TicketInstallmentRequest::$STATUS_ACCEPTED;
+ } else {
+ $status = TicketInstallmentRequest::$STATUS_REJECTED;
+
+ if ( $kod == "xx"){
+ $comment = "Nem található a detsta fájlban a tétel válasza";
+ }else{
+ if ( array_key_exists($kod, GiroDETSTATetel::$INFORMACIOK)){
+ $comment = "Hiba kód: ".$kod ." - " .GiroDETSTATetel::$INFORMACIOK[$kod];
+ }else{
+ $comment = "Ismeretlen hiba kód: " .$kod;
+ }
+ }
+ }
+
+ $this->megbizas->applyStatus($status,true,$kod,$comment);
+
+
+ // $this->readTicket();
+ // if ( !$this->hasError() ){
+ // $this->applyNewMegbizasState();
+ // $this->applyNewTicketState();
+ // $this->addTransfer();
+ // }
+ }
+
+ // public function readMegbizas(){
+ // $this->megbizas = TicketInstallmentRequest::findOne($this->tetel->ugyfelAzonosito);
+ // if ( !isset($this->megbizas) ){
+ // $this->errors [] = "Válaszban jelölt megbízás nem található! (".$this->tetel->ugyfelAzonosito." )";
+ // }
+ // }
+ // public function readTicket(){
+ // $this->ticket = $this->megbizas->ticket;
+ // if ( !isset($this->ticket) ){
+ // $this->errors [] = "Válaszban jelölt bérlet nem található! (".$this->megbizas->id_ticket." )";
+ // }
+ // }
+
+ // public function applyNewMegbizasState(){
+ // $kod = 'xx';
+ // if ( isset($this->tetel ) ) {
+ // $kod = $this->tetel->visszajelzesInformacio;
+ // }
+
+ // if ( $kod == GiroDETSTATetel::$INFORMACIO_TELJESITETT){
+ // $this->megbizas->status = TicketInstallmentRequest::$STATUS_ACCEPTED;
+ // }else{
+ // $this->megbizas->status = TicketInstallmentRequest::$STATUS_REJECTED;
+ // }
+ // if ( !$this->isDryRun() ){
+ // $this->megbizas->save(false);
+ // }
+ // }
+
+ // public function applyNewTicketState(){
+ // $this->ticket->applyTicketInstallmentRequest($this->megbizas);
+ // if ( !$this->isDryRun() ){
+ // $this->ticket->save(false);
+ // }
+ // }
+
+ // protected function addTransfer(){
+
+ // $account = Account::findOne($this->ticket->id_account);
+ // $discount = null;
+ // if ( isset($this->ticket->id_account)){
+ // $discount = Discount::findOne( $this->ticket->id_discount );
+ // }
+
+ // $transfer = Transfer::createTicketTransfer($account, $discount, null, 1, $this->ticket);
+
+ // $transfer->status = Transfer::STATUS_PAID;
+ // $transfer->paid_at = date('Y-m-d H:i:s' ) ;
+ // $transfer->paid_by = \Yii::$app->user->id;
+ // $transfer->payment_method = Transfer::PAYMENT_METHOD_TRANSFER;
+ // $transfer->money = $this->megbizas->money;
+ // $transfer->comment = "Csoportos beszedes";
+ // $transfer->id_user = \Yii::$app->user->id;
+ // $transfer->id_customer = $this->ticket->id_customer;
+ // $transfer->save(false);
+ // }
+ public function hasError() {
+ return count ( $this->errors ) > 0;
+ }
+ public function isDryRun() {
+ return $this->dryRun;
+ }
+}
\ No newline at end of file
diff --git a/common/components/giro/GiroBase.php b/common/components/giro/GiroBase.php
index 075d55e..60971c0 100644
--- a/common/components/giro/GiroBase.php
+++ b/common/components/giro/GiroBase.php
@@ -29,11 +29,11 @@ class GiroBase {
return $data;
}
- public function szovegOlvas($row,$start,$length, $padchar = " "){
+ public static function szovegOlvas($row,$start,$length, $padchar = " "){
return rtrim(substr($row, $start,$length),$padchar);
}
- public function szamOlvas($row,$start,$length, $padchar = "0"){
+ public static function szamOlvas($row,$start,$length, $padchar = "0"){
return ltrim(substr($row, $start,$length),$padchar);
}
diff --git a/common/components/giro/GiroBeszed.php b/common/components/giro/GiroBeszed.php
index 2605ce7..3d3ba31 100644
--- a/common/components/giro/GiroBeszed.php
+++ b/common/components/giro/GiroBeszed.php
@@ -15,19 +15,24 @@ class GiroBeszed extends GiroBase {
public function __construct() {
}
- public static function createFileContent($id, $requests) {
- $s = self::createFej($id);
- $s .= self::createTetelek($requests);
+
+
+ public static function createFileContent($number,$datum /**összeállítás dátum*/, $requests, $terhelesiDatum = null) {
+ if ( !isset($terhelesiDatum)){
+ $terhelesiDatum = date('Ymd' ,strtotime("+5 day"));
+ }
+ $s = self::createFej($number, $datum);
+ $s .= self::createTetelek($requests,$terhelesiDatum);
$s .= self::createLab($requests);
return $s;
}
- public static function createFej($id) {
+ public static function createFej($number, $daturm) {
$fej = new GiroBeszedFej ();
$fej->duplumKod = \Yii::$app->params['ugiro_duplom_kod'];
$fej->kezdemenyezoAzonosito = \Yii::$app->params['ugiro_kezdemenyezo_azonosito'];//"A25366936T244"; // "66658092128";
- $fej->uzenetSorszam->osszeallitasDatuma = date('Ymd' );
- $fej->uzenetSorszam->sorszam = $id;
+ $fej->uzenetSorszam->osszeallitasDatuma = $daturm;
+ $fej->uzenetSorszam->sorszam = $number;
$fej->kezdemenyezoBankszamla->szamlaszam = \Yii::$app->params['ugiro_kezdemenyezo_szamlaszam']; // "5860025215371128";
// $fej->kezdemenyezoBankszamla->bankszerv = "58600252"; // "TAKBHUHB";
$fej->ertesitesiHatarido = "";
@@ -36,10 +41,12 @@ class GiroBeszed extends GiroBase {
return $fej->toString ();
}
- public static function createTetelek($requests){
+ public static function createTetelek($requests,$terhelesiDatum){
$s = "";
+ $i = 0;
foreach ($requests as $request){
- $s .= self::createTetel($request);
+ $i++;
+ $s .= self::createTetel($request,$i,$terhelesiDatum);
}
return $s;
}
@@ -47,19 +54,19 @@ class GiroBeszed extends GiroBase {
/**
* @param common\models\TicketInstallmentRequest $request
* */
- public static function createTetel($request) {
+ public static function createTetel($request,$sorszam,$terhelesiDatum) {
$tetel = new GiroBeszedTetel ();
$customer = $request->customer;
- $tetel->tetelSorszam = $request->id_ticket_installment_request;
- $tetel->terhelesiDatum = date('Ymd' ,strtotime("+5 day"));;
+ $tetel->tetelSorszam = $sorszam;
+ $tetel->terhelesiDatum = $terhelesiDatum;
$tetel->osszeg = $request->money;
// $tetel->kotelezettBankszamla->bankszerv = "58600252";
$tetel->kotelezettBankszamla->szamlaszam = $customer->bank_account;
- $tetel->ugyfelazonositoAKezdemenyezonel = $customer->id_customer;
+ $tetel->ugyfelazonositoAKezdemenyezonel = $request->id_ticket_installment_request;
// $tetel->ugyfelNeve = "Schneider Roland";
// $tetel->ugyfelCime = "Mosonmagyarovar, Gardonyi 31";
$tetel->szamlaTulajdonosNeve = $customer->name;
- $tetel->kozlemeny = "Berlet :" . $request->id_ticket;
+ $tetel->kozlemeny = "Berlet:" . $request->id_ticket .";MegbizasAzo:" . $request->id_ticket_installment_request;
return $tetel->toString();
}
diff --git a/common/components/giro/GiroDETSTA.php b/common/components/giro/GiroDETSTA.php
index 22cc26b..3dab266 100644
--- a/common/components/giro/GiroDETSTA.php
+++ b/common/components/giro/GiroDETSTA.php
@@ -6,8 +6,9 @@ use common\components\giro\GiroBase;
/**
*
- * @property common\components\giro\GiroUzenetsorszam $uzenetSorszam
- * @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
+ * @property common\components\giro\GiroDETSTAFej $fej
+ * @property common\components\giro\GiroDETSTALab $lab
+ * @property common\components\giro\GiroDETSTATetel $tetelek
*
*/
class GiroDETSTA extends GiroBase {
@@ -20,14 +21,25 @@ class GiroDETSTA extends GiroBase {
}
+ public function toString(){
+ $s = "";
+ $s .= $this->fej->toString();
+ foreach ($this->tetelek as $tetel ){
+ $s .= $tetel->toString();
+ }
+ $s .= $this->lab->toString();
+
+ return $s;
+ }
+
public static function parse($content){
$detsta = new GiroDETSTA();
$array = preg_split("/\r\n|\n|\r/", $content);
$detsta->fej = GiroDETSTAFej::parse($array[0]);
- $detsta->lab = GiroDETSTALab::parse($array[count($array) -1]);
+ $detsta->lab = GiroDETSTALab::parse($array[count($array) -2]);
- for ( $i = 1 ; $i < count($array) -1; $i++ ){
+ for ( $i = 1 ; $i < count($array) -2; $i++ ){
$row = $array[$i];
$tetel = GiroDETSTATetel::parse($row);
$detsta->tetelek[] = $tetel;
diff --git a/common/components/giro/GiroDETSTAFej.php b/common/components/giro/GiroDETSTAFej.php
index 13bf96b..1a509c0 100644
--- a/common/components/giro/GiroDETSTAFej.php
+++ b/common/components/giro/GiroDETSTAFej.php
@@ -43,7 +43,7 @@ class GiroDETSTAFej extends GiroBase{
$fej->jelentesJelzo = substr($row, 8,1);
$fej->kezdemenyezoAzonosito = substr($row, 9,13);
$fej->csoportosUzenetSorszam ->osszeallitasDatuma = substr($row, 22, 8);
- $fej->csoportosUzenetSorszam->sorszam = substr($row, 30, 4);
+ $fej->csoportosUzenetSorszam->sorszam = static::szamOlvas($row, 30, 4);
$fej->detstaUzenetSorszam ->osszeallitasDatuma = substr($row, 34,8);
$fej->detstaUzenetSorszam->sorszam = substr($row, 42,4);
$fej->ido = substr($row, 46,6);
diff --git a/common/components/giro/GiroDETSTALab.php b/common/components/giro/GiroDETSTALab.php
index ae18a12..d015963 100644
--- a/common/components/giro/GiroDETSTALab.php
+++ b/common/components/giro/GiroDETSTALab.php
@@ -17,8 +17,10 @@ class GiroDETSTALab extends GiroBase {
public $visszautasitottTetelekOsszerteke = "0";
public $megNemValaszoltTetelekSzama = "0";
public $megNemValaszoltTetelekOsszerteke = "0";
+
public function __construct() {
}
+
public function toString() {
return $this->recordTipus
. $this->szamKitolt ( $this->teljesitettTetelekSzama, 6 )
diff --git a/common/components/giro/GiroDETSTATetel.php b/common/components/giro/GiroDETSTATetel.php
index f2bf20c..f59afc8 100644
--- a/common/components/giro/GiroDETSTATetel.php
+++ b/common/components/giro/GiroDETSTATetel.php
@@ -39,7 +39,17 @@ class GiroDETSTATetel extends GiroBase {
$this->detstaUzenetSorszam = new GiroUzenetsorszam ();
}
public function toString() {
- return $this->recordTipus . $this->szamKitolt ( $this->tetelSorszam, 6 ) . $this->szamKitolt ( $this->osszeg, 10 ) . $this->eredetiTetelElszamolasiDatuma . $this->visszajelzesInformacio . $this->feldolgozasDatum . $this->terhelesiDatum . $this->szovegKitolt ( $this->valaszHivatkozasiKod, 29 ) . $this->szovegKitolt ( $this->eredetiHivatkozasiKod, 29 ) . $this->szovegKitolt ( $this->ugyfelAzonosito, 29 );
+ return $this->recordTipus
+ . $this->szamKitolt ( $this->tetelSorszam, 6 )
+ . $this->szamKitolt ( $this->osszeg, 10 )
+ . $this->eredetiTetelElszamolasiDatuma
+ . $this->visszajelzesInformacio
+ . $this->feldolgozasDatum
+ . $this->terhelesiDatum
+ . $this->szovegKitolt ( $this->valaszHivatkozasiKod, 29 )
+ . $this->szovegKitolt ( $this->eredetiHivatkozasiKod, 29 )
+ . $this->szovegKitolt ( $this->ugyfelAzonosito, 24 )
+ . $this->rekordVege();
}
public static function parse($row) {
diff --git a/common/models/AccountState.php b/common/models/AccountState.php
index 3936121..0ec2689 100644
--- a/common/models/AccountState.php
+++ b/common/models/AccountState.php
@@ -233,7 +233,8 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
$this->prev_state = $lastOpen->id_account_state;
$this->prev_money = $lastOpen->money;
}
- $end = date("Y-m-d H:i:s");
+ $end = date('Y-m-d H:i:s' );
+// $end = Yii::$app->formatter->asDatetime(strtotime("now"), "php:Y-m-d H:i:s");
$this->collection_money = Transfer::readPaid($start, $end, Yii::$app->user->id);
diff --git a/common/models/MoneyMovement.php b/common/models/MoneyMovement.php
index 9024c0a..b111181 100644
--- a/common/models/MoneyMovement.php
+++ b/common/models/MoneyMovement.php
@@ -29,6 +29,9 @@ class MoneyMovement extends \yii\db\ActiveRecord
const TYPE_OUT = 10;
const TYPE_IN = 20;
+ const STATUS_PAID = 20;
+ const STATUS_STORNO = 30;
+
public $_account;
/**
@@ -140,4 +143,23 @@ class MoneyMovement extends \yii\db\ActiveRecord
return self::typeName($this->type);
}
+ public static function statuses( ) {
+ return [
+ MoneyMovement::STATUS_PAID => 'Fizetve',
+ MoneyMovement::STATUS_STORNO => 'Törölve',
+ ];
+ }
+
+ public static function toStatusName($id_status){
+ $result = "Ismeretlen";
+ $statuses = Ticket::statuses();
+ if ( array_key_exists($id_status, $statuses)){
+ $result = $statuses[$id_status];
+ }
+ return $result;
+ }
+
+ public function getStatusName(){
+ return static::toStatusName($this->status);
+ }
}
diff --git a/common/models/Sale.php b/common/models/Sale.php
index d3a6e5c..6ed7abe 100644
--- a/common/models/Sale.php
+++ b/common/models/Sale.php
@@ -37,6 +37,7 @@ class Sale extends \yii\db\ActiveRecord
const STATUS_NOT_PAID = 10;
const STATUS_PAID = 20;
+ const STATUS_DELETED= 30;
/**
* @inheritdoc
@@ -140,4 +141,26 @@ class Sale extends \yii\db\ActiveRecord
return $sale;
}
+
+ public static function statuses( ) {
+ return [
+ Sale::STATUS_PAID => 'Aktív',
+ Sale::STATUS_DELETED => 'Törölve',
+ Sale::STATUS_NOT_PAID => 'Nincs fizetve',
+ ];
+ }
+
+ public static function toStatusName($id_status){
+ $result = "Ismeretlen";
+ $statuses = Sale::statuses();
+ if ( array_key_exists($id_status, $statuses)){
+ $result = $statuses[$id_status];
+ }
+ return $result;
+ }
+
+ public function getStatusName(){
+ return static::toStatusName($this->status);
+ }
+
}
diff --git a/common/models/Ticket.php b/common/models/Ticket.php
index d82aef5..e15eaf7 100644
--- a/common/models/Ticket.php
+++ b/common/models/Ticket.php
@@ -23,6 +23,9 @@ use common\components\Helper;
* @property integer $usage_count
* @property integer $status
* @property integer $price_brutto
+ * @property integer $part eddig a részletig kell kifizetve lenni
+ * @property integer $part_count ennyi részlet van összesen
+ * @property integer $part_paid ennyi részlet van kifizetve
* @property string $comment
* @property string $created_at
* @property string $updated_at
@@ -31,6 +34,7 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
{
const STATUS_DELETED = 0;
const STATUS_ACTIVE = 10;
+ const STATUS_INACTIVE = 20;
/**
* @inheritdoc
@@ -200,10 +204,10 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
new Expression( 'ticket_type.name as name'),
new Expression( 'coalesce( count(ticket.id_ticket),0) as total'),
- new Expression( "coalesce( sum( case when ". Helper::sqlValidRule('ticket.start', 'ticket.end', ':start', ':end') . " then 1 else 0 end) , 0) as valid" ), //valid
- new Expression( "coalesce( sum( case when ". Helper::sqlInIntervalRule('ticket.created_at', ':start', ':end') . " then 1 else 0 end) , 0) as created" ),//created
- new Expression( "coalesce( sum( case when ". Helper::sqlInIntervalRule('ticket.created_at', ':start', ':end') . " then transfer.money else 0 end) , 0) as created_money" ),//created_money
- new Expression( "coalesce( sum( case when " . Helper::sqlExpireRule('ticket.start', 'ticket.end', ':start', ":end") . " then 1 else 0 end) , 0) as expired" ),
+ new Expression( "coalesce( sum( case when ticket.status <> " .Ticket::STATUS_DELETED ." AND ". Helper::sqlValidRule('ticket.start', 'ticket.end', ':start', ':end') . " then 1 else 0 end) , 0) as valid" ), //valid
+ new Expression( "coalesce( sum( case when ticket.status <> " .Ticket::STATUS_DELETED ." AND ". Helper::sqlInIntervalRule('ticket.created_at', ':start', ':end') . " then 1 else 0 end) , 0) as created" ),//created
+ new Expression( "coalesce( sum( case when ticket.status <> " .Ticket::STATUS_DELETED ." AND ". Helper::sqlInIntervalRule('ticket.created_at', ':start', ':end') . " then transfer.money else 0 end) , 0) as created_money" ),//created_money
+ new Expression( "coalesce( sum( case when ticket.status <> " .Ticket::STATUS_DELETED ." AND " . Helper::sqlExpireRule('ticket.start', 'ticket.end', ':start', ":end") . " then 1 else 0 end) , 0) as expired" ),
]);
@@ -237,6 +241,7 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
return [
Ticket::STATUS_ACTIVE => 'Aktív',
Ticket::STATUS_DELETED => 'Törölve',
+ Ticket::STATUS_INACTIVE => 'Inaktív',
];
}
@@ -249,4 +254,62 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
return $result;
}
+ public function getStatusName(){
+ return static::toStatusName($this->status);
+ }
+
+ public function isDeleted(){
+ return $this->status == Ticket::STATUS_DELETED;
+ }
+
+ /**csoportos beszedéses a bérlet*/
+ public function isInstallmentTicket(){
+ return ( isset($this->part_count) && $this->part_count > 0 );
+ }
+
+ /**
+ * Apply request
+ *
+ * @var common\models\TicketInstallmentRequest $request megbízás
+ * */
+ public function applyTicketInstallmentRequest( $request ) {
+ //ha csoportos beszedéses
+ if ( $this->isInstallmentTicket() ){
+ if ( $request->isStatusAccepted() ){
+ if ( $this->part_paid < $request->priority ){
+ $this->part_paid = $request->priority;
+ }
+ $this->recalclulate();
+ }else if ( $request->isStatusRejected() ){
+ $this->status = static::STATUS_INACTIVE;
+ }
+ }
+ }
+ /*
+ * *
+ * @param common\models\TicketInstallmentRequest $request megbízás
+ */
+ public function setPartRequired($request){
+ // ha keveseb a részlet sorszám mint a bérlet max sorszáma
+ if ( $request->priority <= $this->part_count ){
+ //ha az aktuális elvárt részlet kisebb , mint a megbízása
+ if ( $this->part < $request-> priority ){
+ $this->part = $request->priority;
+ }
+ }
+ }
+
+ /**
+ * Csoportos beszedéses bérlet érvényességének újraszámolása
+ * */
+ public function recalclulate( ) {
+ if ( $this->isInstallmentTicket() ){
+ $enabled = $this->part_paid >= $this->part;
+ if ( $enabled == true ){
+ $this->status = static::STATUS_ACTIVE;
+ }else{
+ $this->status = static::STATUS_INACTIVE;
+ }
+ }
+ }
}
diff --git a/common/models/TicketInstallmentRequest.php b/common/models/TicketInstallmentRequest.php
index f38cf18..4f7fc7f 100644
--- a/common/models/TicketInstallmentRequest.php
+++ b/common/models/TicketInstallmentRequest.php
@@ -25,6 +25,7 @@ use yii\behaviors\TimestampBehavior;
* @property string $request_target_time_at
* @property string $created_at
* @property string $updated_at
+ * @property common\components\giro\GiroDETSTATetel $detstaTetel GiroDetstaTetel record a DetSta fájlból
*/
class TicketInstallmentRequest extends \yii\db\ActiveRecord
{
@@ -36,6 +37,12 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
public static $STATUS_CANCELED = 30;
public static $STATUS_REJECTED = 40;
public static $STATUS_ACCEPTED = 50;
+ public static $STATUS_ACCEPTED_MANUAL = 60;
+
+ /**
+ * GiroDetstaTetel record a DetSta fájlból
+ * */
+ public $detstaTetel;
/**
* @inheritdoc
@@ -98,6 +105,90 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
return $this->hasOne( Customer::className(), ["id_customer" =>"id_customer" ] );
}
+ public function getTicket(){
+ return $this->hasOne( Ticket::className(), ["id_ticket" =>"id_ticket", ] ) ;
+ }
+
+ public function getUgiro()
+ {
+ return $this->hasOne(Ugiro::className(), [ 'id_ugiro' => 'id_ugiro' ])
+ ->viaTable('ugiro_request_assignment', [ 'id_request' => 'id_ticket_installment_request' ]);
+ }
+
+ public function isStatusAccepted(){
+ return $this->status == static::$STATUS_ACCEPTED || $this->status == static::$STATUS_ACCEPTED_MANUAL;
+ }
+ public function isStatusRejected(){
+ return $this->status == static::$STATUS_REJECTED ;
+ }
+
+ public function getIdGiro(){
+ $result = null;
+ $giro = $this->ugiro;
+ if ( isset($giro) ){
+ $result = $giro->id_ugiro;
+ }
+ return $result;
+ }
+
+ /**
+ * Megbízás státuszának beállítása
+ *
+ * Létrehozza a szükséges ticket/transfer objectumokat
+ *
+ * @param boolean $partRequired ha igaz, a bérleten a part mezőt változtatjuk
+ * */
+ public function applyStatus($status, $partRequired = false, $visszajelzes = "", $comment = ""){
+ if ( $status == static::$STATUS_ACCEPTED || $status == static::$STATUS_ACCEPTED_MANUAL){
+ if ( !$this->isStatusAccepted() ){
+ $this->status = $status;
+ $tranfer = $this->addTransfer();
+ $this->id_transfer = $tranfer->id_transfer;
+ $this->save(false);
+ $this->applyNewTicketState($partRequired);
+ return true;
+ }else{
+ return false;
+ }
+ }else{
+ $this->status = $status;
+ $this->save(false);
+ $this->applyNewTicketState($partRequired);
+ return true;
+ }
+ }
+
+ protected function applyNewTicketState($partRequired = false){
+ if ( $partRequired ){
+ $this->ticket->setPartRequired($this);
+ }
+ $this->ticket->applyTicketInstallmentRequest($this);
+ $this->ticket->save(false);
+ }
+
+ protected function addTransfer(){
+
+ $account = Account::findOne($this->ticket->id_account);
+ $discount = null;
+ if ( isset($this->ticket->id_account)){
+ $discount = Discount::findOne( $this->ticket->id_discount );
+ }
+
+ $transfer = Transfer::createTicketTransfer($account, $discount, null, 1, $this->ticket);
+
+ $transfer->status = Transfer::STATUS_PAID;
+ $transfer->paid_at = date('Y-m-d H:i:s' ) ;
+ $transfer->paid_by = \Yii::$app->user->id;
+ $transfer->payment_method = Transfer::PAYMENT_METHOD_TRANSFER;
+ $transfer->money = $this->money;
+ $transfer->comment = "Csoportos beszedes";
+ $transfer->id_user = \Yii::$app->user->id;
+ $transfer->id_customer = $this->ticket->card->customer->id_customer;
+ $transfer->save(false);
+ return $transfer;
+ }
+
+
/**
* @param common\models\Ticket $ticket
* @param common\models\TicketType $type
@@ -107,8 +198,12 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
$result = [];
if ( $type->isInstallment() ){
$count = $type->installment_count;
- $ticketCreatedAt = time();
+ $discount = $ticket->discount;
$money = $type->price_brutto;
+ if ( isset($discount ) ){
+ $money = Discount::applyDiscount($money, $discount);
+ }
+ $ticketCreatedAt = time();
for ( $i = 1; $i <= $count; $i++){
$request = TicketInstallmentRequest::createInstallment($ticket, $type, $customer, $money, $ticketCreatedAt, $i);
$result[] = $request;
@@ -140,6 +235,7 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
TicketInstallmentRequest::$STATUS_CANCELED=> 'Törölve',
TicketInstallmentRequest::$STATUS_REJECTED=> 'Visszautasítva',
TicketInstallmentRequest::$STATUS_ACCEPTED=> 'Sikeresen végrehajtva',
+ TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL=> 'Manuálisan elfogadva',
];
}
diff --git a/common/models/Transfer.php b/common/models/Transfer.php
index c92eca5..ff8847b 100644
--- a/common/models/Transfer.php
+++ b/common/models/Transfer.php
@@ -46,6 +46,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
const STATUS_NOT_PAID = 10;
const STATUS_PAID = 20;
+ const STATUS_STORNO = 30;
const DIRECTION_OUT = 10;// MONEY GOES OUT FROM ACCOUNT ( COMPANY LOST MONEY )
const DIRECTION_IN = 20;//MONEY GOES IN TO THE ACCOUNT ( COMPANY EARN MONEY )
@@ -477,6 +478,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
return [
self::STATUS_NOT_PAID => Yii::t('common/transfer','Nincs fizetve'),
self::STATUS_PAID => Yii::t('common/transfer','Fizetve'),
+ self::STATUS_STORNO => Yii::t('common/transfer','Törölve'),
];
}
public function getStatusName( ) {
@@ -751,6 +753,28 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
}
-
+ public function storno(){
+ $this->status = Transfer::STATUS_STORNO;
+ $this->save(false);
+ if ( $this->type == Transfer::TYPE_TICKET){
+ $ticket = $this->ticket;
+ $ticket->status = Ticket::STATUS_DELETED;
+ $ticket->save(false);
+
+ TicketInstallmentRequest::updateAll(
+ ['status' => TicketInstallmentRequest::$STATUS_CANCELED ],
+ ['id_ticket' => $this->ticket->id_ticket ]
+ );
+
+ }else if ( $this->type == Transfer::TYPE_PRODUCT ){
+ $sale = $this->sale;
+ $sale->status = Sale::STATUS_DELETED;
+ $sale->save(false);
+ }else if ( $this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT ){
+ $mm = $this->moneyMovement;
+ $mm->status = MoneyMovement::STATUS_STORNO;
+ $mm->save(false);
+ }
+ }
}
diff --git a/common/models/Ugiro.php b/common/models/Ugiro.php
index 8423407..7544e9b 100644
--- a/common/models/Ugiro.php
+++ b/common/models/Ugiro.php
@@ -11,6 +11,10 @@ use yii\helpers\ArrayHelper;
*
* @property integer $id_ugiro
* @property integer $id_user
+ * @property string $path
+ * @property string $desta_path
+ * @property string $datum
+ * @property integer $number
* @property string $created_at
* @property string $updated_at
*/
@@ -18,8 +22,10 @@ class Ugiro extends \yii\db\ActiveRecord
{
public static $PATH_MEGBIZAS = "giro/megbizas";
+ public static $PATH_VALASZ = "giro/valasz";
public static $STATUS_SENT = 0;
- public static $STATUS_FINISHED = 1;
+ public static $STATUS_RECIEVED = 10;
+ public static $STATUS_FINISHED = 20;
/**
* @inheritdoc
@@ -66,10 +72,19 @@ class Ugiro extends \yii\db\ActiveRecord
return $this->hasOne( User::className(), ["id" =>"id_user" ] );
}
+
+ public function getRequests()
+ {
+ return $this->hasMany(TicketInstallmentRequest::className(), ['id_ticket_installment_request' => 'id_request'])
+ ->viaTable('ugiro_request_assignment', ['id_ugiro' => 'id_ugiro']);
+ }
+
+
public static function statuses() {
return [
static::$STATUS_SENT =>"Folyamatban",
static::$STATUS_FINISHED =>"Befejezve",
+ static::$STATUS_RECIEVED =>"Detsta fájl feltöltve",
]
;
}
diff --git a/console/migrations/m160120_224044_alter__table__money_movement__add_column__status.php b/console/migrations/m160120_224044_alter__table__money_movement__add_column__status.php
new file mode 100644
index 0000000..689630f
--- /dev/null
+++ b/console/migrations/m160120_224044_alter__table__money_movement__add_column__status.php
@@ -0,0 +1,30 @@
+addColumn("money_movement", "status", "int");
+ }
+
+ public function down()
+ {
+ echo "m160120_224044_alter__table__money_movement__add_column__status cannot be reverted.\n";
+
+ return false;
+ }
+
+ /*
+ // Use safeUp/safeDown to run migration code within a transaction
+ public function safeUp()
+ {
+ }
+
+ public function safeDown()
+ {
+ }
+ */
+}
diff --git a/console/migrations/m160121_083841_alter__table__ticket__add_part__and__parts_paid.php b/console/migrations/m160121_083841_alter__table__ticket__add_part__and__parts_paid.php
new file mode 100644
index 0000000..da724bf
--- /dev/null
+++ b/console/migrations/m160121_083841_alter__table__ticket__add_part__and__parts_paid.php
@@ -0,0 +1,32 @@
+addColumn("ticket", "part", "int");
+ $this->addColumn("ticket", "part_count", "int");
+ $this->addColumn("ticket", "part_paid", "int");
+ }
+
+ public function down()
+ {
+ echo "m160121_083841_alter__table__ticket__add_part__and__parts_paid cannot be reverted.\n";
+
+ return false;
+ }
+
+ /*
+ // Use safeUp/safeDown to run migration code within a transaction
+ public function safeUp()
+ {
+ }
+
+ public function safeDown()
+ {
+ }
+ */
+}
diff --git a/console/migrations/m160121_183512_alter__table__ugiro__add__desta_path.php b/console/migrations/m160121_183512_alter__table__ugiro__add__desta_path.php
new file mode 100644
index 0000000..e4c34ca
--- /dev/null
+++ b/console/migrations/m160121_183512_alter__table__ugiro__add__desta_path.php
@@ -0,0 +1,30 @@
+addColumn("ugiro", "desta_path", "string");
+ }
+
+ public function down()
+ {
+ echo "m160121_183512_alter__table__ugiro__add__desta_path cannot be reverted.\n";
+
+ return false;
+ }
+
+ /*
+ // Use safeUp/safeDown to run migration code within a transaction
+ public function safeUp()
+ {
+ }
+
+ public function safeDown()
+ {
+ }
+ */
+}
diff --git a/console/migrations/m160121_192759_alter__table__ugiro__uzenet__sorszam.php b/console/migrations/m160121_192759_alter__table__ugiro__uzenet__sorszam.php
new file mode 100644
index 0000000..a8cb534
--- /dev/null
+++ b/console/migrations/m160121_192759_alter__table__ugiro__uzenet__sorszam.php
@@ -0,0 +1,28 @@
+addColumn("ugiro", "datum", "string");
+ $this->addColumn("ugiro", "number", "integer");
+ }
+
+ public function down()
+ {
+ }
+
+ /*
+ // Use safeUp/safeDown to run migration code within a transaction
+ public function safeUp()
+ {
+ }
+
+ public function safeDown()
+ {
+ }
+ */
+}
diff --git a/frontend/controllers/AccountStateController.php b/frontend/controllers/AccountStateController.php
index 2b15d45..9e73d51 100644
--- a/frontend/controllers/AccountStateController.php
+++ b/frontend/controllers/AccountStateController.php
@@ -162,7 +162,7 @@ class AccountStateController extends Controller {
$total += $cassaOpen->money;
$openDate = $cassaOpen->created_at;
}
- $total += Transfer::readPaid($openDate, date('Y-m-d h:i:s'), \Yii::$app->user->id);
+ $total += Transfer::readPaid($openDate, date('Y-m-d H:i:s'), \Yii::$app->user->id);
return $total;
}
diff --git a/frontend/controllers/TicketController.php b/frontend/controllers/TicketController.php
index c98cea8..9260c96 100644
--- a/frontend/controllers/TicketController.php
+++ b/frontend/controllers/TicketController.php
@@ -21,6 +21,7 @@ use common\models\UserSoldItem;
use frontend\components\FrontendController;
use frontend\components\DefaultAccountBehavior;
use frontend\components\CassaOpenBehavior;
+use frontend\models\TicketUpdate;
/**
* TicketController implements the CRUD actions for Ticket model.
@@ -38,7 +39,7 @@ class TicketController extends FrontendController
],
'access' => [
'class' => \yii\filters\AccessControl::className(),
- 'only' => ['create', 'index' ],
+ 'only' => ['create', 'index','update' ],
'rules' => [
// allow authenticated users
[
@@ -135,6 +136,21 @@ class TicketController extends FrontendController
]);
}
+ public function actionUpdate($id){
+ $model = TicketUpdate::findOne($id);
+
+ if ( !isset($model)){
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['index', 'number' => $model->card->number]);
+ }
+
+ return $this->render('update',['model' => $model]);
+
+ }
+
/**
* Deletes an existing Transfer model.
* If deletion is successful, the browser will be redirected to the 'index' page.
@@ -152,12 +168,21 @@ class TicketController extends FrontendController
try {
ShoppingCart::deleteAll([ 'id_transfer' => $transfer->id_transfer]);
UserSoldItem::deleteAll([ 'id_transfer' => $transfer->id_transfer]);
- if ( $transfer->delete() ){
- \Yii::$app->session->setFlash( 'success','Bérlet törölve' );
- $transaction->commit();
- }else{
- throw new \Exception("Failed to save");
- }
+// $transfer->status = Transfer::STATUS_STORNO;
+// $transfer->save(false);
+// $ticket->status = Ticket::STATUS_DELETED;
+// $ticket->save(false);
+ $transfer->storno();
+ $transaction->commit();
+ \Yii::$app->session->setFlash( 'success','Bérlet törölve' );
+
+ // $transaction->commit();
+// if ( $transfer->delete() ){
+// \Yii::$app->session->setFlash( 'success','Bérlet törölve' );
+// $transaction->commit();
+// }else{
+// throw new \Exception("Failed to save");
+// }
} catch(Exception $e) {
$transaction->rollback();
diff --git a/frontend/controllers/TransferController.php b/frontend/controllers/TransferController.php
index f5cac04..14729b8 100644
--- a/frontend/controllers/TransferController.php
+++ b/frontend/controllers/TransferController.php
@@ -222,12 +222,13 @@ class TransferController extends Controller
try {
ShoppingCart::deleteAll([ 'id_transfer' => $transfer->id_transfer]);
UserSoldItem::deleteAll([ 'id_transfer' => $transfer->id_transfer]);
- if ( $transfer->delete() ){
- \Yii::$app->session->setFlash( 'success','Tranzakció törölve' );
- $transaction->commit();
- }else{
- throw new \Exception("Failed to save");
- }
+ $transfer->storno();
+// if ( $transfer->delete() ){
+ \Yii::$app->session->setFlash( 'success','Tranzakció törölve' );
+ $transaction->commit();
+// }else{
+// throw new \Exception("Failed to save");
+// }
} catch(Exception $e) {
$transaction->rollback();
diff --git a/frontend/models/TicketCreate.php b/frontend/models/TicketCreate.php
index 181aa9f..3c6e33d 100644
--- a/frontend/models/TicketCreate.php
+++ b/frontend/models/TicketCreate.php
@@ -83,6 +83,7 @@ class TicketCreate extends Ticket{
//cart
/////////////////////
[['cart'], 'string', 'max' => 10]
+
];
}
@@ -91,6 +92,18 @@ class TicketCreate extends Ticket{
$type = TicketType::findOne($this->id_ticket_type);
if ( !isset($type)) {
$this->addError($attribute,Yii::t('frontend/ticket' , 'Invalid ticket type' ));
+ }else{
+ if ( $type->isInstallment()){
+ $bankAccount = trim($this->customer->bank_account);
+ if ( !isset($bankAccount) || empty($bankAccount)){
+ $this->addError($attribute,"Nincs bankszámlaszám vagy érvénytelen");
+ return;
+ }
+ if ( !( strlen($bankAccount) == 16 || strlen($bankAccount) == 24 ) ){
+ $this->addError($attribute,"Vendég bankszámlaszáma nem 16 vagy 24 hosszú");
+ return;
+ }
+ }
}
}
@@ -108,6 +121,23 @@ class TicketCreate extends Ticket{
}
}
+ public function beforeSave($insert){
+ $result = parent::beforeSave($insert);
+ if ( $result ){
+ if ($insert){
+ $ticketType = TicketType::findOne($this->id_ticket_type);
+ if ( isset($ticketType) && $ticketType->isInstallment() ){
+ $this->part = 0;
+ $this->part_paid = 0;
+ $this->part_count = $ticketType->installment_count;
+ }else{
+ $this->part_count = 0;
+ }
+ }
+ }
+ return $result;
+ }
+
public function afterSave($insert, $changedAttributes){
$this->addTransfer();
$this->appendToUserCart();
diff --git a/frontend/models/TicketUpdate.php b/frontend/models/TicketUpdate.php
new file mode 100644
index 0000000..c1e3a0f
--- /dev/null
+++ b/frontend/models/TicketUpdate.php
@@ -0,0 +1,25 @@
+ [ static ::STATUS_ACTIVE, static ::STATUS_INACTIVE ]],
+
+ ];
+ }
+
+
+
+ }
+
+
+?>
\ No newline at end of file
diff --git a/frontend/views/money-movement/index.php b/frontend/views/money-movement/index.php
index 1e985dd..0067de3 100644
--- a/frontend/views/money-movement/index.php
+++ b/frontend/views/money-movement/index.php
@@ -36,6 +36,11 @@ $this->params['breadcrumbs'][] = $this->title;
'attribute' => 'comment',
'format' => 'html'
],
+ [
+ 'attribute' => 'status',
+ 'value' => 'statusName',
+ 'label' => "Státusz"
+ ],
['class' => 'yii\grid\ActionColumn',
'template' => '{view}'
diff --git a/frontend/views/ticket/_form_update.php b/frontend/views/ticket/_form_update.php
new file mode 100644
index 0000000..28a498f
--- /dev/null
+++ b/frontend/views/ticket/_form_update.php
@@ -0,0 +1,84 @@
+
+
+
+
+ 'id_user',
+ 'value' => $model->user->username
+ ]
+ ,
+ [
+ 'attribute' => 'id_ticket_type',
+ 'value' => $model->ticketTypeName
+ ]
+ ,
+ [
+ 'attribute' => 'id_account',
+ 'value' => $model->accountName
+ ]
+ ,
+ [
+ 'attribute' => 'id_discount',
+ 'value' => $model->discountName
+ ]
+ ,
+ 'start:datetime',
+ 'end:datetime',
+ 'max_usage_count',
+ 'usage_count',
+ // [
+ // 'attribute' => 'status',
+ // 'value' => $model->statusName
+ // ],
+ 'price_brutto',
+ 'comment:raw',
+ 'created_at',
+ 'updated_at'
+];
+
+
+if ( $model->status == Ticket::STATUS_DELETED ){
+ $attributes[] = [
+ 'attribute' => 'status',
+ 'value' => $model->statusName
+ ];
+}
+
+?>
+
+ =DetailView::widget ( [ 'model' => $model,'attributes' => $attributes ] )?>
diff --git a/frontend/views/ticket/index.php b/frontend/views/ticket/index.php
index 3386bba..131152f 100644
--- a/frontend/views/ticket/index.php
+++ b/frontend/views/ticket/index.php
@@ -6,6 +6,7 @@ use frontend\components\ReceptionMenuWidget;
use frontend\components\ReceptionCardNumberWidget;
use frontend\components\ReceptionWidget;
use yii\base\Widget;
+use common\models\Ticket;
/* @var $this yii\web\View */
/* @var $searchModel frontend\models\TicketSearch */
@@ -34,7 +35,11 @@ $this->params['breadcrumbs'][] = $this->title;
= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
-
+ [
+ 'attribute' => 'id_ticket',
+ 'value' => 'id_ticket',
+ 'label' => "B. Azonosító"
+ ],
[
'attribute' => 'id_account',
'value' => 'accountName'
@@ -51,6 +56,10 @@ $this->params['breadcrumbs'][] = $this->title;
'attribute' => 'id_user',
'value' => 'userName'
],
+ [
+ 'attribute' => 'status',
+ 'value' => 'statusName'
+ ],
/*
[
'attribute' => 'id_discount',
@@ -58,9 +67,31 @@ $this->params['breadcrumbs'][] = $this->title;
],
*/
'price_brutto',
+
'created_at:datetime',
['class' => 'yii\grid\ActionColumn',
- 'template' =>'{delete}',
+ 'template' =>'{delete} {update}',
+ 'buttons' => [
+ 'update' => function($url, $model, $key){
+ return $model->status == Ticket::STATUS_DELETED ? "" : Html::a('
', $url,
+ [ 'title' => "Bérlet törlése", 'class'=>'btn btn-primary btn-xs', ]) ;
+ },
+ 'delete' => function($url, $model, $key){
+ return $model->status == Ticket::STATUS_DELETED ? "" : Html::a('
', $url,
+ [ 'title' => "Bérlet módosítása", 'class'=>'btn btn-primary btn-xs', 'data-method' =>'post']) ;
+ },
+ ],
+// 'buttons ' => [
+
+// 'update' =>function ($url, $model, $key){
+// return "update";
+// },
+// 'delete' =>function ($url, $model, $key){
+// return "delete";
+
+// }
+// ]
+// 'template' => function($model){ return $model->status == Ticket::STATUS_DELETED ? "" : "'{delete} {update}'" ;},
],
],
]); ?>
diff --git a/frontend/views/ticket/update.php b/frontend/views/ticket/update.php
index 09f838a..422c44d 100644
--- a/frontend/views/ticket/update.php
+++ b/frontend/views/ticket/update.php
@@ -5,9 +5,7 @@ use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Ticket */
-$this->title = Yii::t('common/ticket', 'Update {modelClass}: ', [
- 'modelClass' => 'Ticket',
-]) . ' ' . $model->id_ticket;
+$this->title = "Bérlet módosítása:" . ' ' . $model->id_ticket;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket', 'Tickets'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id_ticket, 'url' => ['view', 'id' => $model->id_ticket]];
$this->params['breadcrumbs'][] = Yii::t('common/ticket', 'Update');
@@ -16,7 +14,7 @@ $this->params['breadcrumbs'][] = Yii::t('common/ticket', 'Update');
= Html::encode($this->title) ?>
- = $this->render('_form', [
+ = $this->render('_form_update', [
'model' => $model,
]) ?>
diff --git a/frontend/views/transfer/_view.php b/frontend/views/transfer/_view.php
index f04328b..836357c 100644
--- a/frontend/views/transfer/_view.php
+++ b/frontend/views/transfer/_view.php
@@ -69,13 +69,15 @@ $formatter = Yii::$app->formatter;