/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Vendorproducts::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['Pid' => $this->Pid]);
     $query->andFilterWhere(['like', 'ProductName', $this->ProductName])->andFilterWhere(['like', 'Quatity', $this->Quatity])->andFilterWhere(['like', 'Weight', $this->Weight])->andFilterWhere(['like', 'Price', $this->Price])->andFilterWhere(['like', 'Discount', $this->Discount]);
     return $dataProvider;
 }
Пример #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params        	
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     if (isset($params['vendorId'])) {
         $vendorId = $params['vendorId'];
         $query = Vendorproducts::find()->where("vendorId = {$vendorId} and \tEndDate >= CURDATE()");
     } else {
         $query = Vendorproducts::find();
     }
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['Saleid' => $this->Saleid]);
     $query->andFilterWhere(['like', 'productId', $this->productId])->andFilterWhere(['like', 'Brand', $this->Brand])->andFilterWhere(['like', 'Quantity', $this->Quantity])->andFilterWhere(['like', 'uom', $this->uom])->andFilterWhere(['like', 'AltQty', $this->AltQty])->andFilterWhere(['like', 'AltUom', $this->AltUom])->andFilterWhere(['like', 'UnitPrice', $this->UnitPrice])->andFilterWhere(['like', 'SalePrice', $this->SalePrice])->andFilterWhere(['like', 'PriceUnit', $this->PriceUnit])->andFilterWhere(['like', 'StartDate', $this->StartDate])->andFilterWhere(['like', 'EndDate', $this->EndDate])->andFilterWhere(['like', 'ReserveCount', $this->ReserveCount])->andFilterWhere(['like', 'SaleInd', $this->SaleInd])->andFilterWhere(['like', 'categoryName', $this->categoryName]);
     //print_r($dataProvider->getModels());exit();
     return $dataProvider;
 }
Пример #3
0
 public static function getTotalsalleitems($vendorId)
 {
     $totalsaleItems = Vendorproducts::find()->where("(StartDate > '2015-11-07' OR StartDate = '2015-11-07') AND vendorId={$vendorId} ")->count();
     return $totalsaleItems;
 }