コード例 #1
0
 public function search($params)
 {
     $query = GlHeader::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_gl' => $this->id_gl, 'gl_date' => $this->gl_date, 'id_branch' => $this->id_branch, 'id_periode' => $this->id_periode, 'type_reff' => $this->type_reff, 'id_reff' => $this->id_reff, 'status' => $this->status, 'create_at' => $this->create_at, 'create_by' => $this->create_by, 'update_at' => $this->update_at, 'update_by' => $this->update_by]);
     $query->andFilterWhere(['like', 'gl_num', $this->gl_num])->andFilterWhere(['like', 'gl_memo', $this->gl_memo])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
コード例 #2
0
ファイル: Helper.php プロジェクト: advance100/sangkilbiz3
 public static function createGL($hdr, $dtls = [])
 {
     $blc = 0.0;
     foreach ($dtls as $row) {
         $blc += $row['ammount'];
     }
     if ($blc != 0) {
         throw new UserException('GL Balance Failed');
     }
     $gl = new GlHeader();
     $gl->gl_date = $hdr['date'];
     $gl->id_reff = $hdr['id_reff'];
     $gl->type_reff = $hdr['type_reff'];
     $gl->description = $hdr['description'];
     $gl->id_branch = $hdr['id_branch'];
     /*
      * Edited By Mujib Masyhudi
      * on 2014-07-07
      */
     $active_periode = self::getCurrentIdAccPeriode();
     $gl->id_periode = $active_periode['id_periode'];
     $gl->status = 0;
     if (!$gl->save()) {
         throw new UserException(implode("\n", $gl->getFirstErrors()));
     }
     foreach ($dtls as $row) {
         $glDtl = new GlDetail();
         $glDtl->id_gl = $gl->id_gl;
         $glDtl->id_coa = $row['id_coa'];
         $glDtl->amount = $row['ammount'];
         if (!$glDtl->save()) {
             throw new UserException(implode("\n", $glDtl->getFirstErrors()));
         }
     }
 }
コード例 #3
0
 /**
  * Finds the GlHeader model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param  integer               $id
  * @return GlHeader              the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = GlHeader::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #4
0
ファイル: GL.php プロジェクト: jimminababan/sangkilbiz3
 public static function modelClass()
 {
     return GlHeader::className();
 }
コード例 #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getGlHeaders()
 {
     return $this->hasMany(GlHeader::className(), ['id_periode' => 'id_periode']);
 }
コード例 #6
0
ファイル: GlDetail.php プロジェクト: jimminababan/sangkilbiz3
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdGl()
 {
     return $this->hasOne(GlHeader::className(), ['id_gl' => 'id_gl']);
 }