/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Pegawai::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['idkantor' => $this->idkantor]); $query->andFilterWhere(['like', 'nip', $this->nip])->andFilterWhere(['like', 'nama', $this->nama])->andFilterWhere(['like', 'pangkatgol', $this->pangkatgol])->andFilterWhere(['like', 'jabatan', $this->jabatan])->andFilterWhere(['like', 'unit', $this->unit])->andFilterWhere(['like', 'status', $this->status]); return $dataProvider; }
<?php echo $form->field($model, 'nippemeriksa')->dropDownList(ArrayHelper::map(Pegawai::find()->all(), 'nip', 'nama'), ['prompt' => 'pilih NIP Pemeriksa']); ?> <?php echo $form->field($model, 'nipatasan1')->dropDownList(ArrayHelper::map(Pegawai::find()->all(), 'nip', 'nama'), ['prompt' => 'pilih NIP Atasan1']); ?> <?php echo $form->field($model, 'nipatasan2')->dropDownList(ArrayHelper::map(Pegawai::find()->all(), 'nip', 'nama'), ['prompt' => 'pilih NIP Atasan2']); ?> <?php echo $form->field($model, 'usercreated')->textInput(['maxlength' => 50]); ?> <?php echo $form->field($model, 'idkantor')->textInput(); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?>
/** * Finds the Pegawai model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Pegawai the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Pegawai::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getNipatasan20() { return $this->hasOne(Pegawai::className(), ['nip' => 'nipatasan2']); }
public function actionCetakWord($id) { $tmaster = Tmaster::findOne($id); $kapal = Kapal::find()->where(['kapal_id' => $tmaster->idkapal])->all(); $agen = Tagen::find()->where(['id' => $tmaster->idagen])->all(); $negpelabuhan = Tnegpelabuhan::find()->where(['idpel' => $tmaster->idpelasal])->all(); $nippemeriksa = Pegawai::find()->where(['nip' => $tmaster->nippemeriksa])->all(); $nipatasan1 = Pegawai::find()->where(['nip' => $tmaster->nipatasan1])->all(); $nipatasan2 = Pegawai::find()->where(['nip' => $tmaster->nipatasan2])->all(); // Initalize the TBS instance $OpenTBS = new \hscstudio\export\OpenTBS(); // new instance of TBS // Change with Your template kaka $template = Yii::getAlias('@hscstudio/export') . '/templates/opentbs/lhpspword1.docx'; $OpenTBS->LoadTemplate($template); // Also merge some [onload] automatic fields (depends of the type of document). $OpenTBS->VarRef['xnolhpsp'] = $tmaster->nolphsp; $OpenTBS->VarRef['xtgllhpsp'] = $tmaster->tgllhpsp; $OpenTBS->VarRef['xvoy'] = $tmaster->voy; $OpenTBS->VarRef['xtglpeldatang'] = $tmaster->tglpeldatang; $OpenTBS->VarRef['xjumlahkemasan'] = $tmaster->jumlahkemasan; $OpenTBS->VarRef['xsatuan'] = $tmaster->satuan; $OpenTBS->VarRef['xvolume'] = $tmaster->volume; $OpenTBS->VarRef['xberat'] = $tmaster->berat; $OpenTBS->VarRef['xbc11'] = $tmaster->bc11; $OpenTBS->VarRef['xtglbc11'] = $tmaster->tglbc11; $OpenTBS->VarRef['xbc12'] = $tmaster->bc12; $OpenTBS->VarRef['xtglbc12'] = $tmaster->tglbc12; $OpenTBS->VarRef['xbc13'] = $tmaster->bc13; $OpenTBS->VarRef['xtglbc13'] = $tmaster->tglbc13; $OpenTBS->VarRef['xlhpsp'] = $tmaster->lhpsp; $data = []; foreach ($kapal as $kapals) { $data[] = ['kapal_nama' => $kapals->kapal_nama, 'kapal_neg' => $kapals->kapal_neg]; } $OpenTBS->MergeBlock('data', $data); $b1 = []; foreach ($agen as $agens) { $b1[] = ['namaagen' => $agens->namaagen]; } $OpenTBS->MergeBlock('b1', $b1); $b2 = []; foreach ($negpelabuhan as $negpelabuhans) { $b2[] = ['negarapelabuhan' => $negpelabuhans->negarapelabuhan]; } $OpenTBS->MergeBlock('b2', $b2); $b5 = []; foreach ($nippemeriksa as $nippemeriksas) { $b5[] = ['nip' => $nippemeriksas->nip, 'nama' => $nippemeriksas->nama]; } $OpenTBS->MergeBlock('b3', $b5); $b5 = []; foreach ($nipatasan1 as $nipatasan1s) { $b5[] = ['nip' => $nipatasan1s->nip, 'nama' => $nipatasan1s->nama]; } $OpenTBS->MergeBlock('b4', $b5); $b5 = []; foreach ($nipatasan2 as $nipatasan2s) { $b5[] = ['nip' => $nipatasan2s->nip, 'nama' => $nipatasan2s->nama]; } $OpenTBS->MergeBlock('b5', $b5); // Output the result as a file on the server. You can change output file $OpenTBS->Show(OPENTBS_DOWNLOAD, 'export.docx'); // Also merges all [onshow] automatic fields. exit; }