Exemplo n.º 1
0
 public function actionExportWord()
 {
     //$searchModel = new MahasiswaSearch();
     //$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     // Initalize the TBS instance
     $OpenTBS = new \hscstudio\export\OpenTBS();
     // new instance of TBS
     // Change with Your template kaka
     $template = Yii::$app->basePath . '/web/upload/hrd/form/' . '2016-02 PKWTT.docx';
     //$template = Yii::getAlias('@hscstudio/export').'/templates/opentbs/ms-word.docx';
     $OpenTBS->LoadTemplate($template);
     // Also merge some [onload] automatic fields (depends of the type of document).
     //$OpenTBS->VarRef['modelName']= "Mahasiswa";
     $data = [];
     $no = 1;
     // foreach($dataProvider->getModels() as $mahasiswa){
     // $data[] = [
     // 'no'=>$no++,
     // 'nama'=>$mahasiswa->nama,
     // 'nim'=>$mahasiswa->nim,
     // ];
     // }
     $data1[] = ['no' => '1', 'nama' => 'piter', 'nim' => '10'];
     $OpenTBS->MergeBlock('data', $data1);
     // 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;
 }
Exemplo n.º 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();
     /*
             $query = new Query;
             $query	->select([
     		'kapal.kapal_nama AS kapal_nama', 
           'kapal.kapal_neg AS kapal_neg', 
           'tagen.namaagen AS namaagen']
     		
     		)  
     	->from('tmaster')
     	->join('INNER JOIN', 'kapal',
     				'kapal.kapal_id =tmaster.idkapal')		
     	->join('INNER JOIN', 'tagen', 
     				'tagen.id =tmaster.idagen')
     	->LIMIT(2)	; 
     		
             $command = $query->createCommand();
             $datatabel = $command->queryAll();
     */
     // 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];
     }
     /*
            $data = [];
     foreach($datatabel as $datatabels){
         $data[] = [
             'kapal_nama'=> $datatabels->kapal_nama,
             'kapal_neg'=>$datatabels->kapal_neg,
             'namaagen'=>$datatabels->namaagen
                 ];
     }
     */
     $OpenTBS->MergeBlock('data', $data);
     $data1 = [];
     foreach ($agen as $agens) {
         $data1[] = ['namaagen' => $agens->namaagen];
     }
     $OpenTBS->MergeBlock('data1', $data1);
     // 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;
 }
Exemplo n.º 3
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();
     $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;
 }