add feature clear card
This commit is contained in:
@@ -11,9 +11,11 @@ use yii\db\ActiveRecord;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\db\Query;
|
||||
use common\models\Transfer;
|
||||
use yii\helpers\VarDumper;
|
||||
|
||||
/**
|
||||
* TicketSearch represents the model behind the search form about `common\models\Ticket`.
|
||||
* @property commom\models\Customer $customer
|
||||
*/
|
||||
class TicketSearchCustomer extends Ticket
|
||||
{
|
||||
@@ -32,7 +34,9 @@ class TicketSearchCustomer extends Ticket
|
||||
public $statistics;
|
||||
public $statisticsTotal;
|
||||
|
||||
public $customer;
|
||||
public $customer; //constructor param
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -41,7 +45,7 @@ class TicketSearchCustomer extends Ticket
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[[ 'id_ticket', 'id_user', 'id_ticket_type', 'id_account','status'], 'integer'],
|
||||
[[ 'id_ticket', 'id_user', 'id_ticket_type', 'id_account','status' ], 'integer'],
|
||||
[[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||
[[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||
[['valid_in_interval','created_in_interval','expire_in_interval'],'boolean'] ,
|
||||
@@ -113,7 +117,8 @@ class TicketSearchCustomer extends Ticket
|
||||
$query->innerJoin('user', 'user.id = transfer.id_user');
|
||||
$query->leftJoin('user as paid_by', 'paid_by.id = transfer.paid_by');
|
||||
$query->leftJoin('card', 'ticket.id_card = card.id_card');
|
||||
$query->leftJoin('customer', 'customer.id_customer_card = card.id_card');
|
||||
$query->leftJoin('customer', 'customer.id_customer= transfer.id_customer');
|
||||
|
||||
|
||||
Helper::queryAccountConstraint($query, 'ticket.id_account');
|
||||
|
||||
@@ -177,11 +182,12 @@ class TicketSearchCustomer extends Ticket
|
||||
|
||||
|
||||
if (!$this->validate()) {
|
||||
$query->where('0=1');
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
$query->andWhere( ['transfer.id_customer' => $this->customer->id_customer ]);
|
||||
|
||||
$query->andFilterWhere([
|
||||
'ticket.id_user' => $this->id_user,
|
||||
'ticket.id_ticket_type' => $this->id_ticket_type,
|
||||
@@ -191,7 +197,7 @@ class TicketSearchCustomer extends Ticket
|
||||
'ticket.status' => $this->status
|
||||
]);
|
||||
|
||||
$query->andWhere(['customer.id_customer' => $this->customer->id_customer]);
|
||||
// $query->andWhere(['customer.id_customer' => $this->customer->id_customer]);
|
||||
|
||||
|
||||
$all = (!($this->valid_in_interval) && !($this->expire_in_interval) && !($this->created_in_interval) )
|
||||
@@ -230,7 +236,8 @@ class TicketSearchCustomer extends Ticket
|
||||
|
||||
|
||||
public function searchTotals(){
|
||||
$query = Ticket::mkStatisticQuery($this->timestampStart, $this->timestampEnd,$this->id_card);
|
||||
$query = Ticket::mkStatisticQuery($this->timestampStart, $this->timestampEnd);
|
||||
$query->andWhere(["transfer.id_customer" => $this->id ]);
|
||||
$this->statistics = $query->all();
|
||||
|
||||
$this->statisticsTotal =[
|
||||
|
||||
Reference in New Issue
Block a user