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); }
public function actionIndex() { if (isset($_POST['limit'])) { $limit = $_POST['limit']; } else { $limit = 20; } if (isset($_POST['start'])) { $start = $_POST['start']; } else { $start = 0; } $void = Pe::get_voided(T_AKTIVITASGRUP); $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); } $criteria->limit = $limit; $criteria->offset = $start; $criteria->params = $param; $criteria->addNotInCondition('aktivitas_id', $void); $model = PeAktivitasGrupTrans::model()->findAll($criteria); $total = PeAktivitasGrupTrans::model()->count($criteria); $this->renderJson($model, $total); }
static function get_total_beban_grup($start_date, $end_date, $anak_id) { $void = Pe::get_voided(T_AKTIVITASGRUP); // $void = Pe::get_voided(7); $void_st = ''; if (count($void) > 0) { $void_st = "and pe_aktivitas_grup_trans.aktivitas_id not in (" . join(',', $void) . ")"; } $per_anak = $anak_id == 'undefined' ? '' : "AND pe_member.id = {$anak_id}"; $rows = Yii::app()->db->createCommand()->select("Sum(pe_aktivitas_grup_trans.amount) as amount")->from("pe_aktivitas_grup_trans")->rightJoin("pe_aktivitas_grup", "pe_aktivitas_grup_trans.pe_aktivitas_grup_id = pe_aktivitas_grup.id and\r\n pe_aktivitas_grup_trans.trans_date between '{$start_date}' and '{$end_date}' {$void_st}")->queryScalar(); return $rows == null ? 0 : $rows; }