Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = DetailModel::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(['id' => $this->id, 'tgl' => $this->tgl, 'jml' => $this->jml, 'data_time' => $this->data_time, 'hidden' => $this->hidden]);
     $query->andFilterWhere(['like', 'jenis', $this->jenis]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 public static function getTotal()
 {
     $model = DetailModel::find()->select('sum(jml) as jumlah')->where("hidden = 1")->one();
     return $model->jumlah;
 }
Exemplo n.º 3
0
 /**
  * Displays a single DetailModel model.
  * @param integer $id
  * @return mixed
  */
 public function actionDetil($tgl)
 {
     $dataProvider = new ActiveDataProvider(['query' => DetailModel::find()->where("tgl = '{$tgl}' AND hidden = 1"), 'sort' => ['defaultOrder' => ['tgl' => SORT_DESC]]]);
     $data['tgl'] = $tgl;
     return $this->render('detil', ['dataProvider' => $dataProvider, 'data' => $data]);
 }