add feature clear card
This commit is contained in:
@@ -62,22 +62,7 @@ class CustomerSearch extends Customer
|
||||
];
|
||||
|
||||
|
||||
// $dataProvider->setSort(
|
||||
|
||||
|
||||
// [
|
||||
// 'attributes' => [
|
||||
// 'id',
|
||||
// 'fullName' => [
|
||||
// 'asc' => ['first_name' => SORT_ASC, 'last_name' => SORT_ASC],
|
||||
// 'desc' => ['first_name' => SORT_DESC, 'last_name' => SORT_DESC],
|
||||
// 'label' => 'Full Name',
|
||||
// 'default' => SORT_ASC
|
||||
// ],
|
||||
// 'country_id'
|
||||
// ]
|
||||
// ]);
|
||||
|
||||
|
||||
|
||||
$this->load($params);
|
||||
|
||||
@@ -89,18 +74,7 @@ class CustomerSearch extends Customer
|
||||
|
||||
$query->leftJoin(Card::tableName(), " customer.id_customer_card = card.id_card" );
|
||||
|
||||
// $query->andFilterWhere([
|
||||
// 'id_customer' => $this->id_customer,
|
||||
// 'id_customer_card' => $this->id_customer_card,
|
||||
// 'id_user' => $this->id_user,
|
||||
// 'id_partner_card' => $this->id_partner_card,
|
||||
// 'id_proposer' => $this->id_proposer,
|
||||
// 'sex' => $this->sex,
|
||||
// 'date_stundent_card_expire' => $this->date_stundent_card_expire,
|
||||
// 'birthdate' => $this->birthdate,
|
||||
// 'created_at' => $this->created_at,
|
||||
// 'updated_at' => $this->updated_at,
|
||||
// ]);
|
||||
|
||||
|
||||
$query->andFilterWhere(['like', 'customer.name', $this->name])
|
||||
->andFilterWhere(['like', 'customer.email', $this->email])
|
||||
|
||||
@@ -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