Beispiel #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Kapal::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(['kapal_id' => $this->kapal_id]);
     $query->andFilterWhere(['like', 'kapal_nama', $this->kapal_nama])->andFilterWhere(['like', 'kapal_neg', $this->kapal_neg]);
     return $dataProvider;
 }
Beispiel #2
0
 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();
     // 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;
     $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);
     // 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;
 }
Beispiel #3
0
<div class="tmaster-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'nolphsp')->textInput(['maxlength' => 6]);
?>

  
  <?php 
echo $form->field($model, 'tgllhpsp')->widget(DatePicker::className(), ['inline' => false, 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]);
?>
  <?php 
echo $form->field($model, 'idkapal')->widget(Select2::classname(), ['data' => ArrayHelper::map(Kapal::find()->all(), 'kapal_id', 'kapal_nama'), 'language' => 'en', 'options' => ['placeholder' => 'Pilih Kapal ...'], 'pluginOptions' => ['allowClear' => true]]);
?>
           
   
    <?php 
echo $form->field($model, 'voy')->textInput(['maxlength' => 20]);
?>


   <?php 
echo $form->field($model, 'idagen')->dropDownList(ArrayHelper::map(Tagen::find()->all(), 'id', 'namaagen'), ['prompt' => 'pilih negara pelabuhan asal']);
?>
 
  
      <?php 
echo $form->field($model, 'idpelasal')->dropDownList(ArrayHelper::map(Tnegpelabuhan::find()->all(), 'idpel', 'negarapelabuhan'), ['prompt' => 'pilih negara pelabuhan asal']);
Beispiel #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdkapal0()
 {
     return $this->hasOne(Kapal::className(), ['kapal_id' => 'idkapal']);
 }
Beispiel #5
0
 /**
  * Finds the Kapal model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Kapal the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Kapal::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }