Exemplo n.º 1
0
 public function search($params)
 {
     $query = CoaModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_coa' => $this->id_coa, 'id_coa_parent' => $this->id_coa_parent, 'coa_type' => $this->coa_type, 'create_by' => $this->create_by, 'update_by' => $this->update_by]);
     $query->andFilterWhere(['like', 'cd_account', $this->cd_account])->andFilterWhere(['like', 'nm_account', $this->nm_account])->andFilterWhere(['like', 'normal_balance', $this->normal_balance])->andFilterWhere(['like', 'create_date', $this->create_date])->andFilterWhere(['like', 'update_date', $this->update_date]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCoas()
 {
     return $this->hasMany(Coa::className(), ['id_coa_parent' => 'id_coa']);
 }
Exemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdCoa()
 {
     return $this->hasOne(Coa::className(), ['id_coa' => 'id_coa']);
 }
Exemplo n.º 4
0
 public function actionCoaList($term = '')
 {
     $query = Coa::find()->orderBy('cd_account');
     if (!empty($term)) {
         $query->where(['LIKE', 'lower(nm_account)', strtolower($term)]);
     }
     $rCoa = [];
     foreach ($query->all() as $row) {
         $rCoa[] = ['id' => $row->id_coa, 'label' => $row->cd_account . ': ' . $row->nm_account];
     }
     Yii::$app->response->format = Response::FORMAT_JSON;
     return $rCoa;
 }
Exemplo n.º 5
0
 /**
  * @return integer
  */
 public static function getAccountByCode($code)
 {
     $coa = Coa::findOne(['lower(cd_account)' => strtolower($code)]);
     if ($coa) {
         return $coa->id_coa;
     }
     throw new UserException('Akun tidak ditemukan');
 }