/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Emiten::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(['JMLLOT' => $this->JMLLOT, 'JMLSAHAM' => $this->JMLSAHAM, 'SALDO' => $this->SALDO, 'HARGA' => $this->HARGA, 'SALDOR1' => $this->SALDOR1, 'JMLLOTB' => $this->JMLLOTB, 'JMLSAHAMB' => $this->JMLSAHAMB, 'SALDOB' => $this->SALDOB]); $query->andFilterWhere(['like', 'KODE', $this->KODE])->andFilterWhere(['like', 'NAMA', $this->NAMA]); if (!empty($this->KODES)) { $i = 0; foreach ($this->KODES as $key => $value) { if ($value != 'null') { $i++; } } if ($i > 0) { $query->orFilterWhere(['KODE' => $this->KODES]); } $this->KODES = []; } return $dataProvider; }
/** * Finds the Emiten model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Emiten the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Emiten::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function actionGetEmiten($id) { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; if (($model = Emiten::find()->where(['KODE' => $id])->asArray()->one()) !== null) { return ['data' => $model]; } else { return ['data' => '']; } }
/** * @return \yii\db\ActiveQuery */ public function getEMITENKODE() { return $this->hasOne(Emiten::className(), ['KODE' => 'EMITEN_KODE']); }
<div class="col-xs-6 col-sm-3"> <?php echo $form->field($model, 'NOMOR')->textInput(['maxlength' => true, 'readonly' => true, 'style' => 'text-align:center;']); ?> </div> <div class="col-xs-6 col-sm-3 col-sm-offset-6 "> <?php echo $form->field($model, 'TGL')->widget(DatePicker::classname(), ['options' => ['placeholder' => 'Tgl Transaksi ...'], 'readonly' => true, 'removeButton' => false, 'pluginOptions' => ['todayHighlight' => true, 'todayBtn' => true, 'format' => 'dd-M-yyyy', 'autoclose' => true]]); ?> </div> </div> <div class="row"> <div class="col-xs-6 col-sm-3"> <?php $data = ArrayHelper::map(Emiten::find()->select(['KODE', 'NAMA', 'DERIVED' => 'CONCAT(KODE," - ",NAMA)'])->asArray()->all(), 'KODE', 'KODE'); echo $form->field($model, 'EMITEN_KODE')->widget(Select2::classname(), ['data' => $data, 'options' => ['placeholder' => 'Pilih Emiten ...', 'onchange' => ' //var id = Aes.Ctr.encrypt($(this).val(), "123456", 256); var id = $(this).val() $.post( "' . Url::to(['get-emiten']) . '?id="+id, function( data ) { $( "#emiten-name" ).val( data.data.NAMA ); $( "#emiten-name" ).focus(); }); ', 'disabled' => !$model->isNewRecord ? true : false], 'pluginOptions' => ['allowClear' => true]]); ?> </div> <div class="col-xs-6 col-sm-9"> <label class="control-label">Nama Emiten</label> <?php $emiten_name = $model->emiten ? $model->emiten->NAMA : ''; ?>
?> <div class="paramfund-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_search', ['model' => $historyModel, 'dataProviders' => $dataProviders]); ?> <?php if (count($dataProviders) > 0) { echo '<div class="text-right"><strong>TGL & WAKTU : ' . date('d-M-Y H:i:s') . '</strong></div>'; foreach ($dataProviders as $emitenCode => $dataProvider) { echo "<hr>"; echo "<div style='font-weight:bold;'>Emiten: " . $emitenCode; if (($emitenByCode = \app\models\Emiten::find()->where(['KODE' => $emitenCode])->asArray()->one()) !== null) { echo ' (' . $emitenByCode['NAMA'] . ')'; } echo "</div>"; echo GridView::widget(['dataProvider' => $dataProvider, 'responsive' => true, 'responsiveWrap' => true, 'hover' => true, 'resizableColumns' => false, 'showPageSummary' => true, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'TAHUN', 'options' => ['width' => '75px'], 'hAlign' => 'center', 'vAlign' => 'middle'], ['attribute' => 'TRIWULAN', 'options' => ['width' => '75px'], 'hAlign' => 'center', 'vAlign' => 'middle'], ['attribute' => 'SHARE', 'options' => ['width' => '100px'], 'hAlign' => 'center', 'vAlign' => 'middle'], ['attribute' => 'BV', 'options' => ['width' => '80px'], 'hAlign' => 'center', 'vAlign' => 'middle', 'pageSummary' => 'Rata-rata'], ['attribute' => 'P_BV', 'label' => '% BV', 'options' => ['width' => '80px'], 'hAlign' => 'center', 'vAlign' => 'middle', 'pageSummary' => true, 'pageSummaryFunc' => GridView::F_AVG], ['attribute' => 'EPS', 'options' => ['width' => '80px'], 'hAlign' => 'center', 'vAlign' => 'middle'], ['attribute' => 'P_EPS', 'label' => '% EPS', 'options' => ['width' => '80px'], 'hAlign' => 'center', 'vAlign' => 'middle', 'pageSummary' => true, 'pageSummaryFunc' => GridView::F_AVG], ['attribute' => 'PBV', 'options' => ['width' => '80px'], 'hAlign' => 'center', 'vAlign' => 'middle'], ['attribute' => 'PER', 'options' => ['width' => '80px'], 'hAlign' => 'center', 'vAlign' => 'middle'], ['attribute' => 'DER', 'options' => ['width' => '80px'], 'hAlign' => 'center', 'vAlign' => 'middle'], ['attribute' => 'HARGA', 'label' => 'Harga', 'options' => [], 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'right', 'vAlign' => 'middle']]]); } echo "<hr>"; echo Html::a('<i class="glyphicon glyphicon-print"></i> Cetak EXCEL', ['export-excel'], ['class' => 'btn btn-default']) . " "; echo Html::a('<i class="glyphicon glyphicon-print"></i> Cetak PDF', ['export-pdf'], ['class' => 'btn btn-default']); } ?> </div>
public function getEmiten($id) { if (($model = Emiten::find()->where(['KODE' => $id])->asArray()->one()) !== null) { return $model; } else { return null; } }