/** * IMPORT DATA EXCEL * @return mixed * @author piter [ptr.nov@gmail.com] */ public function actionIndex() { $username = Yii::$app->user->identity->username; $user_id = ['USER_ID' => $username]; $paramFile = Yii::$app->getRequest()->getQueryParam('id'); if ($paramFile) { $errorModal = self::setDataImport($paramFile); $data_view = Yii::$app->db_esm->createCommand("\n\t\t\t\t#CALL ESM_SALES_IMPORT_TEMP_view('STOCK','" . $username . "')\n\t\t\t\tSELECT ID,TGL,CUST_KD_ALIAS,CUST_NM,ITEM_ID_ALIAS,ITEM_NM,QTY_PCS,QTY_UNIT,DIS_REF,DIS_REF_NM,SO_TYPE,POS,USER_ID,STATUS\n\t\t\t\tFROM so_t2_tmp_file\n\t\t\t\tWHERE USER_ID='" . $username . "' AND SO_TYPE=1\n\t\t\t")->queryAll(); //print_r($data_view); //die(); if ($errorModal == 1) { $js = '$("#error-msg-stockgudang").modal("show")'; $this->getView()->registerJs($js); } elseif (!$data_view) { $js = '$("#nodata-msg-stockgudang").modal("show")'; $this->getView()->registerJs($js); } } else { //DELETE STOCK GUDANG | SO_TYPE=1 $cmd_clear = Yii::$app->db_esm->createCommand("\n\t\t\t\t\tDELETE FROM so_t2_tmp_file WHERE USER_ID='" . $username . "' AND SO_TYPE=1;\n\t\t\t"); $cmd_clear->execute(); } //echo $paramCari; $model = new UserFileGudang(); /*IMPORT VALIDATION*/ $searchModel = new TempDataSearch($user_id); $dataProvider = $searchModel->searchGudang(Yii::$app->request->queryParams); /*VIEW IMPORT*/ $searchModelViewImport = new ImportViewSearch(); $dataProviderViewImport = $searchModelViewImport->searchViewLatesGudang(Yii::$app->request->queryParams); $dataProviderAllDataImport = $searchModelViewImport->searchViewHistoryGudang(Yii::$app->request->queryParams); //echo $this->actionExport_format(); //print_r($dataProvider->getModels()); return $this->render('index', ['getArryFile' => $dataProvider, 'fileName' => $paramFile, 'gvValidateArrayDataProvider' => $dataProvider, 'searchModelValidate' => $searchModel, 'modelFile' => $model, 'searchModelViewImport' => $searchModelViewImport, 'dataProviderViewImport' => $dataProviderViewImport, 'searchModelViewImport' => $searchModelViewImport, 'dataProviderAllDataImport' => $dataProviderAllDataImport, 'errorModal' => $errorModal]); }