static function get_payee_payoor($type, $id) { switch ($type) { case KAS_MASUK: $model = MtKasMasuk::model()->findAllByPk($id); return $model->MtDonatur->name; break; case KAS_KELUAR: $model = MtKasKeluar::model()->findAllByPk($id); return $model->MtSuppliers->supp_name; break; case AKTIVITAS: $model = MtAktivitas::model()->findAllByPk($id); return $model->MtSuppliers->supp_name; break; case BANKTRANSFER: $criteria = new CDbCriteria(); $criteria->addCondition('type=' . BANKTRANSFER); $criteria->addCondition("trans_no={$id}"); $model = MtBankTrans::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 = MtBankTrans::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 = MtBankTrans::model()->find($criteria); $jemaat = get_jemaat_from_user_id($model->users_id); return $jemaat->real_name; break; case T_AKTIVITASGRUP: $model = MtAktivitasGrupTrans::model()->findAllByPk($id); return $model->MtSuppliers->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 MtBankTrans('search'); //$model->unsetAttributes(); $criteria = new CDbCriteria(); // $criteria->limit = $limit; // $criteria->offset = $start; $model = MtBankTrans::model()->findAll($criteria); $total = MtBankTrans::model()->count($criteria); if (isset($_GET['MtBankTrans'])) { $model->attributes = $_GET['MtBankTrans']; } if (isset($_GET['output']) && $_GET['output'] == 'json') { $this->renderJson($model, $total); } else { $model = new MtBankTrans('search'); $model->unsetAttributes(); $this->render('admin', array('model' => $model)); } }