public function actionIndex()
 {
     if (!Yii::app()->request->isAjaxRequest) {
         return;
     }
     if (isset($_POST['limit'])) {
         $limit = $_POST['limit'];
     } else {
         $limit = 20;
     }
     if (isset($_POST['start'])) {
         $start = $_POST['start'];
     } else {
         $start = 0;
     }
     $void = Pe::get_voided(KAS_KELUAR);
     $param = array();
     $criteria = new CDbCriteria();
     if (isset($_POST['doc_ref'])) {
         $criteria->addCondition("doc_ref like :doc_ref");
         $param[':doc_ref'] = "%" . $_POST['doc_ref'] . "%";
     }
     if (isset($_POST['no_bukti'])) {
         $criteria->addCondition("no_bukti like :no_bukti");
         $param[':no_bukti'] = "%" . $_POST['no_bukti'] . "%";
     }
     if (isset($_POST['amount'])) {
         $criteria->addCondition("amount = :amount");
         $param[':amount'] = $_POST['amount'];
     }
     if (isset($_POST['trans_date'])) {
         $criteria->addCondition("trans_date = :trans_date");
         $param[':trans_date'] = substr($_POST['trans_date'], 0, 10);
     }
     if (isset($_POST['pe_account_code'])) {
         $criteria->addCondition("pe_account_code = :pe_account_code");
         $param[':pe_account_code'] = substr($_POST['pe_account_code'], 0, 10);
     }
     $criteria->limit = $limit;
     $criteria->offset = $start;
     $criteria->params = $param;
     $criteria->addNotInCondition('kas_keluar_id', $void);
     $model = PeKasKeluar::model()->findAll($criteria);
     $total = PeKasKeluar::model()->count($criteria);
     $this->renderJson($model, $total);
 }
Esempio n. 2
0
 static function get_payee_payoor($type, $id)
 {
     switch ($type) {
         case KAS_MASUK:
             $model = PeKasMasuk::model()->findAllByPk($id);
             return $model->PeDonatur->name;
             break;
         case KAS_KELUAR:
             $model = PeKasKeluar::model()->findAllByPk($id);
             return $model->PeSuppliers->supp_name;
             break;
         case AKTIVITAS:
             $model = PeAktivitas::model()->findAllByPk($id);
             return $model->PeSuppliers->supp_name;
             break;
         case BANKTRANSFER:
             $criteria = new CDbCriteria();
             $criteria->addCondition('type=' . BANKTRANSFER);
             $criteria->addCondition("trans_no={$id}");
             $model = PeBankTrans::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 = PeBankTrans::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 = PeBankTrans::model()->find($criteria);
             $jemaat = get_jemaat_from_user_id($model->users_id);
             return $jemaat->real_name;
             break;
         case T_AKTIVITASGRUP:
             $model = PeAktivitasGrupTrans::model()->findAllByPk($id);
             return $model->PeSuppliers->supp_name;
             break;
     }
 }