diff --git a/changelog.txt b/changelog.txt index 7719a4a..4eae589 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,5 @@ +-0.0.75 + - add unpaid tickets display -0.0.74 - add newsletter changes -0.0.73 diff --git a/common/config/params.php b/common/config/params.php index 2511c36..a5b82df 100644 --- a/common/config/params.php +++ b/common/config/params.php @@ -5,7 +5,7 @@ return [ 'supportEmail' => 'rocho02@gmail.com', 'infoEmail' => 'info@rocho-net.hu', 'user.passwordResetTokenExpire' => 3600, - 'version' => 'v0.0.74', + 'version' => 'v0.0.75', 'company' => 'movar',//gyor 'company_name' => "Freimann Kft.", 'product_visiblity' => 'account',// on reception which products to display. account or global diff --git a/common/models/Ticket.php b/common/models/Ticket.php index b2250f1..81635f1 100644 --- a/common/models/Ticket.php +++ b/common/models/Ticket.php @@ -124,6 +124,11 @@ class Ticket extends \common\models\BaseFitnessActiveRecord public function getCard(){ return $this->hasOne( Card::className(), ["id_card" =>"id_card" ] ); } + + public function getContract(){ + return $this->hasOne( Contract::className(), ["id_contract" =>"id_contract" ] ); + } + public function getCardNumber(){ $result = ""; $card = $this->card; @@ -217,6 +222,31 @@ class Ticket extends \common\models\BaseFitnessActiveRecord return $result; } + /** + * @param common\models\Card $card the card to which we are looking for + * */ + public static function readUnpaid($card){ + + if ( $card == null ) + return []; + + $query = Ticket::find(); + $query->innerJoin("transfer", "transfer.id_object = ticket.id_ticket "); + $today = date('Y-m-d'); + + $query->andWhere(['ticket.id_card' => $card->id_card]); + $query->andWhere( 'ticket.start <= :today' ,[ 'today' => $today] ); + $query->andWhere( 'ticket.end >= :today' ,[ 'today' => $today] ); + $query->andWhere( ['in' ,'ticket.status' ,[ Ticket::STATUS_INACTIVE, Ticket::STATUS_ACTIVE] ]); + $query->andWhere( ["transfer.type" => Transfer::TYPE_TICKET] ); + $query->andWhere( [ "transfer.status" => Transfer::STATUS_NOT_PAID ]); + $query->orderBy([ "ticket.created_at" =>SORT_DESC] ); + + $result = $query->all(); + + return $result; + + } public static function mkStatisticQuery($start,$end,$id_card = null){ diff --git a/frontend/models/ReceptionForm.php b/frontend/models/ReceptionForm.php index 1aa7549..30a9f66 100644 --- a/frontend/models/ReceptionForm.php +++ b/frontend/models/ReceptionForm.php @@ -26,6 +26,7 @@ class ReceptionForm extends Model public $card; public $customer; public $tickets; + public $unpaidTickets; public $defaultAccount; public $cardSearchModel; public $lastCassaState; @@ -77,6 +78,7 @@ class ReceptionForm extends Model if ( $this->card != null ){ $this->customer = $this->card->customer; $this->readValidTickets(); + $this->readUnpaidTicket(); $this->readAssignedKeys(); $this->readContract(); } @@ -183,6 +185,10 @@ class ReceptionForm extends Model $this->tickets = Ticket::readActive($this->card); } + public function readUnpaidTicket(){ + $this->unpaidTickets = Ticket::readUnpaid($this->card); + } + /** * @return true , if card found without customer * */ diff --git a/frontend/views/common/_reception_ticket.php b/frontend/views/common/_reception_ticket.php index 4084565..c690c10 100644 --- a/frontend/views/common/_reception_ticket.php +++ b/frontend/views/common/_reception_ticket.php @@ -105,4 +105,35 @@ if ( isset($model->contract)){ } } +if ( isset( $model->unpaidTickets ) ) { + if ( count($model->unpaidTickets) > 0){ + echo Html::beginTag("div",['class'=>"alert alert-warning", "role"=>"alert"]); + echo Html::beginTag("strong",[ ]); + echo "Fizetetlen bérletek"; + echo Html::endTag("strong"); + echo "