Example #1
0
 public function search($params)
 {
     $query = SalesHdrModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_sales' => $this->id_sales, 'id_branch' => $this->id_branch, 'id_customer' => $this->id_customer, 'id_cashdrawer' => $this->id_cashdrawer, 'sales_date' => $this->sales_date, 'status' => $this->status, 'create_by' => $this->create_by, 'update_by' => $this->update_by]);
     $query->andFilterWhere(['like', 'sales_num', $this->sales_num])->andFilterWhere(['like', 'discount', $this->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 getSalesHdrs()
 {
     return $this->hasMany(SalesHdr::className(), ['id_customer' => 'id_customer']);
 }
 /**
  * Finds the SalesHdr model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return SalesHdr the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = SalesHdr::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdSales()
 {
     return $this->hasOne(SalesHdr::className(), ['id_sales' => 'id_sales']);
 }
Example #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSalesHdrs()
 {
     return $this->hasMany(SalesHdr::className(), ['id_branch' => 'id_branch']);
 }