Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Paramfund::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['BV' => $this->BV, 'P_BV' => $this->P_BV, 'EPS' => $this->EPS, 'P_EPS' => $this->P_EPS, 'PBV' => $this->PBV, 'PER' => $this->PER, 'DER' => $this->DER, 'SHARE' => $this->SHARE, 'HARGA' => $this->HARGA, 'CE' => $this->CE, 'CA' => $this->CA, 'TA' => $this->TA, 'TE' => $this->TE, 'CL' => $this->CL, 'TL' => $this->TL, 'SALES' => $this->SALES, 'NI' => $this->NI, 'ROE' => $this->ROE, 'ROA' => $this->ROA, 'P_TE' => $this->P_TE, 'P_SALES' => $this->P_SALES, 'P_NI' => $this->P_NI]);
     $query->andFilterWhere(['like', 'EMITEN_KODE', $this->EMITEN_KODE])->andFilterWhere(['like', 'TAHUN', $this->TAHUN])->andFilterWhere(['like', 'TRIWULAN', $this->TRIWULAN]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 /**
  * Finds the Paramfund model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $EMITEN_KODE
  * @param string $TAHUN
  * @param string $TRIWULAN
  * @return Paramfund the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($EMITEN_KODE, $TAHUN, $TRIWULAN, $safe = false)
 {
     if (($model = Paramfund::findOne(['EMITEN_KODE' => $EMITEN_KODE, 'TAHUN' => $TAHUN, 'TRIWULAN' => $TRIWULAN])) !== null) {
         return $model;
     } else {
         if ($safe) {
             return;
         } else {
             throw new NotFoundHttpException('The requested page does not exist.');
         }
     }
 }
Exemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getParamfunds()
 {
     return $this->hasMany(Paramfund::className(), ['EMITEN_KODE' => 'KODE']);
 }
 /**
  * Lists all Paramfund models.
  * @return mixed
  */
 public function actionIndex()
 {
     $historyModel = new HistoryParamfund();
     $historyModel->TAHUN_MULAI = date('Y');
     $historyModel->TAHUN_AKHIR = $historyModel->TAHUN_MULAI;
     $historyModel->TRIWULAN_MULAI = 'I';
     if (date('m') >= 9) {
         $historyModel->TRIWULAN_AKHIR = 'IV';
     } else {
         if (date('m') >= 6) {
             $historyModel->TRIWULAN_AKHIR = 'III';
         } else {
             if (date('m') >= 3) {
                 $historyModel->TRIWULAN_AKHIR = 'II';
             } else {
                 $historyModel->TRIWULAN_AKHIR = 'I';
             }
         }
     }
     if ($historyModel->load(Yii::$app->request->post())) {
         $emitenKodes = $historyModel->EMITEN_KODES;
         if (!$emitenKodes) {
             $emitenKodes = [];
         }
         $tahunMulai = $historyModel->TAHUN_MULAI;
         $tahunAkhir = $historyModel->TAHUN_AKHIR;
         $tahuns = [];
         for ($i = $tahunMulai; $i <= $tahunAkhir; $i++) {
             $tahuns[] = $i;
         }
         $triwulanMulai = $historyModel->TRIWULAN_MULAI;
         $triwulanAkhir = $historyModel->TRIWULAN_AKHIR;
         $triwulans = [];
         if ($triwulanMulai == 'I' and $triwulanAkhir == 'IV') {
             $triwulans = ['I', 'II', 'III', 'IV'];
         } else {
             if ($triwulanMulai == 'I' and $triwulanAkhir == 'III') {
                 $triwulans = ['I', 'II', 'III'];
             } else {
                 if ($triwulanMulai == 'I' and $triwulanAkhir == 'II') {
                     $triwulans = ['I', 'II'];
                 } else {
                     if ($triwulanMulai == 'II' and $triwulanAkhir == 'IV') {
                         $triwulans = ['II', 'III', 'IV'];
                     } else {
                         if ($triwulanMulai == 'II' and $triwulanAkhir == 'III') {
                             $triwulans = ['II', 'III'];
                         } else {
                             if ($triwulanMulai == 'III' and $triwulanAkhir == 'IV') {
                                 $triwulans = ['III', 'IV'];
                             } else {
                                 if ($triwulanMulai == $triwulanAkhir) {
                                     $triwulans = [$triwulanMulai];
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $dataProviders = [];
         foreach ($emitenKodes as $kode) {
             $emitenModel = $this->getEmiten($kode);
             if ($emitenModel) {
                 $query = Paramfund::find()->where(['TAHUN' => $tahuns, 'TRIWULAN' => $triwulans, 'EMITEN_KODE' => $kode]);
                 $dataProvider = new ActiveDataProvider(['query' => $query]);
                 $dataProvider->getSort()->defaultOrder = ['TAHUN' => SORT_ASC, 'TRIWULAN' => SORT_ASC];
                 $dataProviders[$kode] = $dataProvider;
             }
         }
         if (!empty($dataProviders)) {
             $session = Yii::$app->session;
             $session->set('dataProviders', $dataProviders);
             return $this->render('index', ['historyModel' => $historyModel, 'dataProviders' => $dataProviders]);
         } else {
             return $this->render('index', ['historyModel' => $historyModel]);
         }
     } else {
         return $this->render('index', ['historyModel' => $historyModel]);
     }
 }