示例#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;
 }
示例#2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCoas()
 {
     return $this->hasMany(Coa::className(), ['id_coa_parent' => 'id_coa']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdCoa()
 {
     return $this->hasOne(Coa::className(), ['id_coa' => 'id_coa']);
 }
 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;
 }
示例#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');
 }