public function search($params)
 {
     $query = ProductStockModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_stock' => $this->id_stock, 'id_warehouse' => $this->id_warehouse, 'id_product' => $this->id_product, 'id_uom' => $this->id_uom, 'create_by' => $this->create_by, 'update_by' => $this->update_by]);
     $query->andFilterWhere(['like', 'qty_stock', $this->qty_stock])->andFilterWhere(['like', 'create_date', $this->create_date])->andFilterWhere(['like', 'update_date', $this->update_date]);
     return $dataProvider;
 }
Exemple #2
0
 public static function getCurrentStockAll($id_product)
 {
     return ProductStock::find()->where(['id_product' => $id_product])->sum('qty_stock');
 }