Exemplo n.º 1
0
 public function add_gl_trans($type, $trans_id, $date_, $account, $memo_, $amount, $person_id)
 {
     $gl_trans = new PahGlTrans();
     $gl_trans->type = $type;
     $gl_trans->type_no = $trans_id;
     $gl_trans->tran_date = $date_;
     $gl_trans->account = $account;
     $gl_trans->memo_ = $memo_;
     $gl_trans->users_id = $person_id;
     $gl_trans->amount = $amount;
     if (!$gl_trans->save()) {
         throw new Exception("Gagal menyimpan transaksi jurnal.");
     }
     return $amount;
 }
Exemplo n.º 2
0
 static function account_in_gl_trans($account)
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition("account = '{$account}'");
     $count = PahGlTrans::model()->count($criteria);
     return $count > 0;
 }
 public function actionIndex()
 {
     if (isset($_POST['limit'])) {
         $limit = $_POST['limit'];
     } else {
         $limit = 20;
     }
     if (isset($_POST['start'])) {
         $start = $_POST['start'];
     } else {
         $start = 0;
     }
     //$model = new PahGlTrans('search');
     //$model->unsetAttributes();
     $criteria = new CDbCriteria();
     //        $criteria->limit = $limit;
     //        $criteria->offset = $start;
     $model = PahGlTrans::model()->findAll($criteria);
     $total = PahGlTrans::model()->count($criteria);
     if (isset($_GET['PahGlTrans'])) {
         $model->attributes = $_GET['PahGlTrans'];
     }
     if (isset($_GET['output']) && $_GET['output'] == 'json') {
         $this->renderJson($model, $total);
     } else {
         $model = new PahGlTrans('search');
         $model->unsetAttributes();
         $this->render('admin', array('model' => $model));
     }
 }