Example #1
0
 public function search($params)
 {
     $query = PurchaseHdrModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_purchase' => $this->id_purchase, 'id_supplier' => $this->id_supplier, 'id_branch' => $this->id_branch, 'purchase_date' => $this->purchase_date, 'status' => $this->status, 'create_by' => $this->create_by, 'update_by' => $this->update_by]);
     $query->andFilterWhere(['like', 'purchase_num', $this->purchase_num])->andFilterWhere(['like', 'purchase_value', $this->purchase_value])->andFilterWhere(['like', 'item_discount', $this->item_discount])->andFilterWhere(['like', 'create_date', $this->create_date])->andFilterWhere(['like', 'update_date', $this->update_date]);
     return $dataProvider;
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPurchaseHdrs()
 {
     return $this->hasMany(PurchaseHdr::className(), ['id_supplier' => 'id_supplier']);
 }
 /**
  * Finds the PurchaseHdr model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return PurchaseHdr the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = PurchaseHdr::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPurchaseHdrs()
 {
     return $this->hasMany(PurchaseHdr::className(), ['id_branch' => 'id_branch']);
 }
Example #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdPurchase()
 {
     return $this->hasOne(PurchaseHdr::className(), ['id_purchase' => 'id_purchase']);
 }