add kulcsok, add tartós beszedés, add ticket type with intallments
This commit is contained in:
@@ -10,6 +10,8 @@ use common\models\Ticket;
|
||||
use common\models\Account;
|
||||
use common\models\CardSearch;
|
||||
use common\models\AccountState;
|
||||
use common\models\Key;
|
||||
use common\models\CardKeyAssignment;
|
||||
|
||||
/**
|
||||
* ContactForm is the model behind the contact form.
|
||||
@@ -23,7 +25,7 @@ class ReceptionForm extends Model
|
||||
public $defaultAccount;
|
||||
public $cardSearchModel;
|
||||
public $lastCassaState;
|
||||
|
||||
public $keys;
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
@@ -53,6 +55,7 @@ class ReceptionForm extends Model
|
||||
if ( $this->card != null ){
|
||||
$this->customer = $this->card->customer;
|
||||
$this->readValidTickets();
|
||||
$this->readAssignedKeys();
|
||||
}
|
||||
|
||||
$defaultAccount = Account::readDefault();
|
||||
@@ -65,6 +68,14 @@ class ReceptionForm extends Model
|
||||
|
||||
}
|
||||
|
||||
public function readAssignedKeys(){
|
||||
$query = Key::find();
|
||||
$query->join( 'INNER JOIN', CardKeyAssignment::tableName() , Key::tableName().".id_key = " . CardKeyAssignment::tableName() . ".id_key");
|
||||
$query->andWhere([ "card_key_assignment.id_card" => $this->card->id_card ]);
|
||||
$this->keys = $query->all();
|
||||
|
||||
}
|
||||
|
||||
public function readLastCassaState(){
|
||||
$a = Account::readDefault();
|
||||
if ( isset($a)){
|
||||
@@ -136,4 +147,23 @@ class ReceptionForm extends Model
|
||||
}
|
||||
|
||||
|
||||
public function getCardNumber(){
|
||||
if ( isset($this->card)){
|
||||
return $this->card->number;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getKeysText(){
|
||||
$keyNumbers = [];
|
||||
$result = "-";
|
||||
if ( isset($this->keys)){
|
||||
foreach ($this->keys as $k ){
|
||||
$keyNumbers[] = $k->number;
|
||||
}
|
||||
$result = implode(", ",$keyNumbers);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user