add contract to detsta processor
This commit is contained in:
parent
df14401b28
commit
0c3ff2c0f3
@ -1,4 +1,4 @@
|
|||||||
01DETSTA8A24237545 201501270001201502094542162957
|
01DETSTA8A24237545 201601250001201601254542162957
|
||||||
020000010000014097201501270020150204201502031104 03916201502031001307001595 0015520150127321538700000000000000000000000340
|
020000010000014097201501270020150204201502031104 03916201502031001307001595 0015520150127321538700000000000000000000000340
|
||||||
020000020000015240201501275020150204 1117 73377201502033417908001595 0015520150127321538800000000000000000000000347
|
020000020000015240201501275020150204 1117 73377201502033417908001595 0015520150127321538800000000000000000000000347
|
||||||
020000030000015240201501270020150204201502031120 94002201502030005151001595 0015520150127321538900000000000000000000000176
|
020000030000015240201501270020150204201502031120 94002201502030005151001595 0015520150127321538900000000000000000000000176
|
||||||
|
|||||||
@ -68,16 +68,16 @@ class DetStatProcessor extends Object{
|
|||||||
|
|
||||||
|
|
||||||
$this->detstatUzenet = new GiroDETSTA();
|
$this->detstatUzenet = new GiroDETSTA();
|
||||||
$this->idKoteg = 33;
|
$this->idKoteg = 37;
|
||||||
|
|
||||||
$fej = new GiroDETSTAFej();
|
$fej = new GiroDETSTAFej();
|
||||||
|
|
||||||
$this->detstatUzenet->fej = $fej;
|
$this->detstatUzenet->fej = $fej;
|
||||||
|
|
||||||
$tetel = new GiroDETSTATetel();
|
$tetel = new GiroDETSTATetel();
|
||||||
$tetel->ugyfelAzonosito = 12;
|
$tetel->tetelSorszam = 1;
|
||||||
$tetel->visszajelzesInformacio = "00";
|
$tetel->visszajelzesInformacio = "00";
|
||||||
$tetel->visszajelzesInformacio = "02";
|
// $tetel->visszajelzesInformacio = "02";
|
||||||
|
|
||||||
$this->detstatUzenet->tetelek[] = $tetel;
|
$this->detstatUzenet->tetelek[] = $tetel;
|
||||||
|
|
||||||
@ -89,12 +89,12 @@ class DetStatProcessor extends Object{
|
|||||||
public function createMegbizasTetelHozzarendelesek(){
|
public function createMegbizasTetelHozzarendelesek(){
|
||||||
$mapTetel = [];
|
$mapTetel = [];
|
||||||
foreach ($this->detstatUzenet->tetelek as $tetel ){
|
foreach ($this->detstatUzenet->tetelek as $tetel ){
|
||||||
$mapTetel[$tetel->ugyfelAzonosito] = $tetel;
|
$mapTetel[$tetel->tetelSorszam] = $tetel;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->megbizasok as $megbizas){
|
foreach ($this->megbizasok as $megbizas){
|
||||||
if ( array_key_exists($megbizas->id_ticket_installment_request, $mapTetel)){
|
if ( array_key_exists($megbizas->number, $mapTetel)){
|
||||||
$megbizas->detstaTetel = $mapTetel[$megbizas->id_ticket_installment_request];
|
$megbizas->detstaTetel = $mapTetel[$megbizas->number];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -75,13 +75,13 @@ class Contract extends \yii\db\ActiveRecord
|
|||||||
'id_user' => Yii::t('common/contract', 'Felhasználó'),
|
'id_user' => Yii::t('common/contract', 'Felhasználó'),
|
||||||
'id_customer' => Yii::t('common/contract', 'Vendég'),
|
'id_customer' => Yii::t('common/contract', 'Vendég'),
|
||||||
'status' => Yii::t('common/contract', 'Státusz'),
|
'status' => Yii::t('common/contract', 'Státusz'),
|
||||||
'flag' => Yii::t('common/contract', 'Flag'),
|
'flag' => Yii::t('common/contract', 'Állapot'),
|
||||||
'part_count' => Yii::t('common/contract', 'Részletek száma'),
|
'part_count' => Yii::t('common/contract', 'Részletek száma'),
|
||||||
'part_paid' => Yii::t('common/contract', 'Fizetett részletek'),
|
'part_paid' => Yii::t('common/contract', 'Fizetett részletek'),
|
||||||
'part_required' => Yii::t('common/contract', 'Esedékes részlet'),
|
'part_required' => Yii::t('common/contract', 'Esedékes részlet'),
|
||||||
'expired_at' => Yii::t('common/contract', 'Lejárati dátum'),
|
'expired_at' => Yii::t('common/contract', 'Lejárati dátum'),
|
||||||
'created_at' => Yii::t('common/contract', 'Létrehozva'),
|
'created_at' => Yii::t('common/contract', 'Létrehozva'),
|
||||||
'updated_at' => Yii::t('common/contract', 'Updated At'),
|
'updated_at' => Yii::t('common/contract', 'Módosítva'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,4 +169,14 @@ class Contract extends \yii\db\ActiveRecord
|
|||||||
public function canCancel() {
|
public function canCancel() {
|
||||||
return $this->flag == static::$FLAG_ACTIVE;
|
return $this->flag == static::$FLAG_ACTIVE;
|
||||||
}
|
}
|
||||||
|
public function isFlagCanceled() {
|
||||||
|
return $this->flag == static::$FLAG_CANCELED;
|
||||||
|
}
|
||||||
|
public function isFlagDeleted() {
|
||||||
|
return $this->flag == static::$FLAG_DELETED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isFlagActive() {
|
||||||
|
return $this->flag == static::$FLAG_ACTIVE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -160,28 +160,41 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
|
|||||||
* @param boolean $partRequired ha igaz, a bérleten a part mezőt változtatjuk
|
* @param boolean $partRequired ha igaz, a bérleten a part mezőt változtatjuk
|
||||||
* */
|
* */
|
||||||
public function applyStatus($status, $partRequired = false, $visszajelzes = "", $comment = ""){
|
public function applyStatus($status, $partRequired = false, $visszajelzes = "", $comment = ""){
|
||||||
|
$contract = $this->contract;
|
||||||
|
$contract->part_required = $contract->part_required +1;
|
||||||
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() ){
|
||||||
$tranfer = $this->addTransfer();
|
$contract->part_paid = $contract->part_paid +1;
|
||||||
|
// $tranfer = $this->addTransfer();
|
||||||
|
$result = Transfer::sellContractTicket($contract, $this, Account::findOne(1), Transfer::STATUS_PAID, Transfer::PAYMENT_METHOD_TRANSFER);
|
||||||
|
$transfer = $result[0];
|
||||||
|
$ticket = $result[1];
|
||||||
$this->status = $status;
|
$this->status = $status;
|
||||||
$this->id_transfer = $tranfer->id_transfer;
|
$this->id_transfer = $transfer->id_transfer;
|
||||||
|
$this->id_ticket = $ticket->id_ticket;
|
||||||
|
|
||||||
$this->request_processed_at = Helper::getDateTimeString();
|
$this->request_processed_at = Helper::getDateTimeString();
|
||||||
$this->save(false);
|
$this->save(false);
|
||||||
|
|
||||||
|
$contract->save(false);
|
||||||
|
|
||||||
|
\Yii::info("Megbízás kifizetve: " . $this->id_ticket_installment_request);
|
||||||
// $this->applyNewTicketState($partRequired);
|
// $this->applyNewTicketState($partRequired);
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
|
\Yii::info("Megbízás már ki volt fizetve: " . $this->id_ticket_installment_request);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$this->status = $status;
|
$this->status = $status;
|
||||||
$this->detsta_answer = $visszajelzes;
|
$this->detsta_answer = $visszajelzes;
|
||||||
$this->comment = $comment;
|
$this->comment = $comment;
|
||||||
$this->request_processed_at = Helper::getDateTimeString();
|
$this->request_processed_at = Helper::getDateTimeString();
|
||||||
$this->save(false);
|
$this->save(false);
|
||||||
|
$contract->save(false);
|
||||||
// $this->applyNewTicketState($partRequired);
|
// $this->applyNewTicketState($partRequired);
|
||||||
|
\Yii::info("Megbízás visszautasítva: " . $this->id_ticket_installment_request);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -264,8 +277,8 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
|
|||||||
TicketInstallmentRequest::$STATUS_SENT=> 'Beküldve',
|
TicketInstallmentRequest::$STATUS_SENT=> 'Beküldve',
|
||||||
TicketInstallmentRequest::$STATUS_CANCELED=> 'Törölve',
|
TicketInstallmentRequest::$STATUS_CANCELED=> 'Törölve',
|
||||||
TicketInstallmentRequest::$STATUS_REJECTED=> 'Visszautasítva',
|
TicketInstallmentRequest::$STATUS_REJECTED=> 'Visszautasítva',
|
||||||
TicketInstallmentRequest::$STATUS_ACCEPTED=> 'Sikeresen végrehajtva',
|
TicketInstallmentRequest::$STATUS_ACCEPTED=> 'Sikeresen beszedés',
|
||||||
TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL=> 'Manuálisan elfogadva',
|
TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL=> 'Személyesen fizetve',
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -977,6 +977,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
|
|||||||
$ticket->price_brutto = $request->money;
|
$ticket->price_brutto = $request->money;
|
||||||
$ticket->id_card = $card->id_card;
|
$ticket->id_card = $card->id_card;
|
||||||
$ticket->part = $request->priority;
|
$ticket->part = $request->priority;
|
||||||
|
$this->id_contract = $contract->id_contract;
|
||||||
$ticket->save ( false );
|
$ticket->save ( false );
|
||||||
|
|
||||||
$transfer = new Transfer ();
|
$transfer = new Transfer ();
|
||||||
|
|||||||
@ -32,7 +32,10 @@ class ContractController extends Controller {
|
|||||||
],
|
],
|
||||||
'payout' => [
|
'payout' => [
|
||||||
'post'
|
'post'
|
||||||
]
|
],
|
||||||
|
'cancel' => [
|
||||||
|
'post'
|
||||||
|
],
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
@ -157,6 +160,7 @@ class ContractController extends Controller {
|
|||||||
|
|
||||||
$result = Transfer::sellContractTicket ( $contract, $part, Account::readDefaultObject (), Transfer::STATUS_NOT_PAID, Transfer::PAYMENT_METHOD_CASH, true );
|
$result = Transfer::sellContractTicket ( $contract, $part, Account::readDefaultObject (), Transfer::STATUS_NOT_PAID, Transfer::PAYMENT_METHOD_CASH, true );
|
||||||
$transfer = $result [0];
|
$transfer = $result [0];
|
||||||
|
$ticket = $result[1];
|
||||||
if ( $part->status != TicketInstallmentRequest::$STATUS_REJECTED ){
|
if ( $part->status != TicketInstallmentRequest::$STATUS_REJECTED ){
|
||||||
$contract->part_required = $contract->part_required +1;
|
$contract->part_required = $contract->part_required +1;
|
||||||
}
|
}
|
||||||
@ -252,6 +256,11 @@ class ContractController extends Controller {
|
|||||||
|
|
||||||
$transaction->commit ();
|
$transaction->commit ();
|
||||||
\Yii::$app->session->setFlash ( 'success', "Szerződés felbontva!" );
|
\Yii::$app->session->setFlash ( 'success', "Szerződés felbontva!" );
|
||||||
|
|
||||||
|
return $this->redirect ( [
|
||||||
|
'product/sale',
|
||||||
|
'number' => $card->number
|
||||||
|
] );
|
||||||
} catch ( Exception $e ) {
|
} catch ( Exception $e ) {
|
||||||
$transaction->rollback ();
|
$transaction->rollback ();
|
||||||
Yii::error ( "Szerződés felbontása nem sikerült!" );
|
Yii::error ( "Szerződés felbontása nem sikerült!" );
|
||||||
|
|||||||
@ -114,7 +114,7 @@ class ReceptionForm extends Model
|
|||||||
$query = Contract::find();
|
$query = Contract::find();
|
||||||
$query->andWhere(['id_customer' => $this->customer->id_customer ]);
|
$query->andWhere(['id_customer' => $this->customer->id_customer ]);
|
||||||
$query->andWhere([ '>=' ,'expired_at' , new Expression("now()") ]);
|
$query->andWhere([ '>=' ,'expired_at' , new Expression("now()") ]);
|
||||||
$query->andWhere(["not in" , 'flag' , [Contract::$FLAG_DELETED, Contract::$FLAG_CANCELED]]);
|
$query->andWhere(["not in" , 'flag' , [Contract::$FLAG_DELETED ]]);
|
||||||
$this->contract = $query->one();
|
$this->contract = $query->one();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@ use common\models\Ticket;
|
|||||||
use frontend\model\ReceptionForm;
|
use frontend\model\ReceptionForm;
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\helpers\Url;
|
use yii\helpers\Url;
|
||||||
|
use common\models\Contract;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model frontend\model\ReceptionForm */
|
/* @var $model frontend\model\ReceptionForm */
|
||||||
@ -60,6 +61,9 @@ if ( isset($model->card)){
|
|||||||
|
|
||||||
|
|
||||||
if ( isset($model->contract)){
|
if ( isset($model->contract)){
|
||||||
|
/** @var common\models\Contract $contract*/
|
||||||
|
$contract = $model->contract;
|
||||||
|
if ( $contract->isFlagActive() ){
|
||||||
if ( $model->contract->isStatusNotPaid() ){
|
if ( $model->contract->isStatusNotPaid() ){
|
||||||
echo Html::beginTag("div",['class'=>"alert alert-danger", "role"=>"alert"]);
|
echo Html::beginTag("div",['class'=>"alert alert-danger", "role"=>"alert"]);
|
||||||
echo Html::beginTag("strong",[ ]);
|
echo Html::beginTag("strong",[ ]);
|
||||||
@ -75,6 +79,17 @@ if ( isset($model->contract)){
|
|||||||
echo Html::endTag("strong");
|
echo Html::endTag("strong");
|
||||||
echo Html::endTag("div");
|
echo Html::endTag("div");
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
if ( $contract->isFlagCanceled() ){
|
||||||
|
echo Html::beginTag("div",['class'=>"alert alert-danger", "role"=>"alert"]);
|
||||||
|
echo Html::beginTag("strong",[ ]);
|
||||||
|
echo "Szerződés felbontva !";
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -7,7 +7,7 @@ use common\models\TicketInstallmentRequest;
|
|||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model common\models\Contract */
|
/* @var $model common\models\Contract */
|
||||||
|
|
||||||
$this->title = $model->id_contract;
|
$this->title = "Szerződés részletek" ;
|
||||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/contract', 'Szerződések'), 'url' => ['index', 'id_card' => $card->id_card]];
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/contract', 'Szerződések'), 'url' => ['index', 'id_card' => $card->id_card]];
|
||||||
$this->params['breadcrumbs'][] = $this->title;
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
?>
|
?>
|
||||||
@ -41,6 +41,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
'part_count',
|
'part_count',
|
||||||
'expired_at:datetime',
|
'expired_at:datetime',
|
||||||
'created_at:datetime',
|
'created_at:datetime',
|
||||||
|
'updated_at:datetime',
|
||||||
],
|
],
|
||||||
]) ?>
|
]) ?>
|
||||||
<?php if ( $model->canCancel() ){?>
|
<?php if ( $model->canCancel() ){?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user