public function add_bank_trans($type, $trans_no, $bank_act, $ref, $date_, $amount, $person_id) { $bank_trans = new PahBankTrans(); $bank_trans->type = $type; $bank_trans->trans_no = $trans_no; $bank_trans->bank_act = $bank_act; $bank_trans->ref = $ref; $bank_trans->trans_date = $date_; $bank_trans->amount = $amount; $bank_trans->users_id = $person_id; if (!$bank_trans->save()) { throw new Exception("Gagal menyimpan transaksi bank."); } }
static function get_payee_payoor($type, $id) { switch ($type) { case KAS_MASUK: $model = PahKasMasuk::model()->findAllByPk($id); return $model->PahDonatur->name; break; case KAS_KELUAR: $model = PahKasKeluar::model()->findAllByPk($id); return $model->PahSuppliers->supp_name; break; case AKTIVITAS: $model = PahAktivitas::model()->findAllByPk($id); return $model->PahSuppliers->supp_name; break; case BANKTRANSFER: $criteria = new CDbCriteria(); $criteria->addCondition('type=' . BANKTRANSFER); $criteria->addCondition("trans_no={$id}"); $model = PahBankTrans::model()->find($criteria); $jemaat = get_jemaat_from_user_id($model->users_id); return $jemaat->real_name; break; case VOID: $criteria = new CDbCriteria(); $criteria->addCondition('type=' . VOID); $criteria->addCondition("trans_no={$id}"); $model = PahBankTrans::model()->find($criteria); $jemaat = get_jemaat_from_user_id($model->users_id); return $jemaat->real_name; break; case SALDO_AWAL: $criteria = new CDbCriteria(); $criteria->addCondition('type=' . SALDO_AWAL); $criteria->addCondition("trans_no={$id}"); $model = PahBankTrans::model()->find($criteria); $jemaat = get_jemaat_from_user_id($model->users_id); return $jemaat->real_name; break; case T_AKTIVITASGRUP: $model = PahAktivitasGrupTrans::model()->findAllByPk($id); return $model->PahSuppliers->supp_name; break; } }
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 PahBankTrans('search'); //$model->unsetAttributes(); $criteria = new CDbCriteria(); // $criteria->limit = $limit; // $criteria->offset = $start; $model = PahBankTrans::model()->findAll($criteria); $total = PahBankTrans::model()->count($criteria); if (isset($_GET['PahBankTrans'])) { $model->attributes = $_GET['PahBankTrans']; } if (isset($_GET['output']) && $_GET['output'] == 'json') { $this->renderJson($model, $total); } else { $model = new PahBankTrans('search'); $model->unsetAttributes(); $this->render('admin', array('model' => $model)); } }