/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function searchid($params) { $params1 = $params['ScheduleheaderSearch']['USER_ID'] != '' ? $params['ScheduleheaderSearch']['USER_ID'] : ''; $query = Userlogin::find()->where(['id' => $params1]); $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([ // 'ID' => $this->ID, // 'TGL1' => $this->TGL1, // 'SCDL_GROUP' => $this->SCDL_GROUP, // 'STATUS' => $this->STATUS, // 'CREATE_AT' => $this->CREATE_AT, // 'UPDATE_AT' => $this->UPDATE_AT, // ]); $query->andFilterWhere(['like', 'id', $params1]); // ->andFilterWhere(['like', 'NOTE', $this->NOTE]) // ->andFilterWhere(['like', 'CREATE_BY', $this->CREATE_BY]) // ->andFilterWhere(['like', 'UPDATE_BY', $this->UPDATE_BY]) // ->andFilterWhere(['like', 'username', $this->getAttribute('user.username')]) // ->andFilterWhere(['like','SCDL_GROUP_NM', $this->getAttribute('scdlgroup.SCDL_GROUP_NM')]); return $dataProvider; }
public function searchonline($params) { $query = \lukisongroup\sistem\models\Userlogin::find()->where('status<>1'); $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(['id' => $this->id]); // $query->andFilterWhere(['like', 'id', $this->id]); // ->andFilterWhere(['like', 'MESSAGE_ATTACH', $this->MESSAGE_ATTACH]) // ->andFilterWhere(['like', 'GROUP', $this->GROUP]); return $dataProvider; }
/** * Creates a new Modulerp model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Modulerp(); if ($model->load(Yii::$app->request->post())) { if ($model->save()) { $datauser = Userlogin::find()->all(); foreach ($datauser as $key => $value) { # code... $connection = Yii::$app->db; $profile = Yii::$app->getUserOpt->Profile_user(); $usercreate = $profile->username; $connection->createCommand()->batchInsert('modul_permission', ['USER_ID', 'MODUL_ID', 'CREATED_BY'], [[$value['id'], $model->MODUL_ID, $usercreate]])->execute(); } } return $this->redirect('index'); } else { return $this->renderAjax('create', ['model' => $model]); } }
public function getUser() { return $this->hasOne(Userlogin::className(), ['id' => 'USER_ID']); }
public function Sendmail3($kd, $empid) { $roHeader = Salesorder::find()->where(['KD_RO' => $kd])->one(); /*Noted check by status approval =1 header table | chek error record jika kosong*/ $detro = $roHeader->detro; $employ = $roHeader->employe; $dept = $roHeader->dept; $roDetail = Sodetail::find()->where(['KD_RO' => $kd])->all(); // element email author :wawan $profile = Yii::$app->getUserOpt->Profile_user(); // profile $user_dephead = $profile->username; // email dephead $user = Userlogin::find()->where(['EMP_ID' => $roHeader->SIG1_ID])->asArray()->one(); $usersign1 = $user['username']; // send mail user create ro $cari = Employe::find()->where(['EMP_ID' => $roHeader->SIG2_ID])->asArray()->one(); $cari_usercc = Employe::find()->where(['DEP_ID' => $cari['DEP_ID']])->andwhere('GF_ID<=3')->asArray()->one(); $usercc = $cari_usercc['EMP_EMAIL']; // email usercc /* PR Filter Status Output to Grid print*/ $dataProvider = new ArrayDataProvider(['key' => 'ID', 'allModels' => $roDetail, 'pagination' => ['pageSize' => 20]]); //PR //$dataProviderFilter = $dataProvider->getModels(); /* $StatusFilter = ["101","10"]; $test1 = ArrayHelper::where($dataProviderFilter, function($key, $StatusFilter) { return is_string($value); }); print_r($test1); */ $content = $this->renderPartial('pdfview_tmp', ['roHeader' => $roHeader, 'detro' => $detro, 'employ' => $employ, 'dept' => $dept, 'dataProvider' => $dataProvider]); $contentMail = $this->renderPartial('sendmailcontent', ['roHeader' => $roHeader, 'detro' => $detro, 'employ' => $employ, 'dept' => $dept, 'dataProvider' => $dataProvider]); /*Body Notify*/ $contentMailAttachBody = $this->renderPartial('postman_body', ['roHeader' => $roHeader, 'dataProvider' => $dataProvider]); $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@lukisongroup/web/widget/pdf-asset/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:12px}', 'options' => ['title' => 'Form Request Order', 'subject' => 'ro'], 'methods' => ['SetHeader' => ['Copyright@LukisonGroup ' . date("r")], 'SetFooter' => ['{PAGENO}']]]); $to = [$usersign1, $usercc, $user_dephead]; \Yii::$app->kirim_email->pdf($contentMail, 'SO', $to, 'Sales-Order', $contentMailAttachBody); }
/** *set personal resign from hrd || form_resign *if EMP_STS equal 3(resign) then Status login not activ *@author wawan */ public function actionResign($id) { $model = $this->findModel($id); $emp_sts = ArrayHelper::map(Status::find()->orderBy('SORT')->asArray()->all(), 'STS_ID', 'STS_NM'); if (!$model->load(Yii::$app->request->post())) { return $this->renderAjax('form_resign', ['model' => $model, 'emp_sts' => $emp_sts]); } else { if (Yii::$app->request->isAjax) { $model->load(Yii::$app->request->post()); return Json::encode(\yii\widgets\ActiveForm::validate($model)); } else { if ($model->load(Yii::$app->request->post())) { //$model->save(); $image = $model->uploadImage(); $date = \Yii::$app->formatter->asDate($model->EMP_RESIGN_DATE, 'yyyy-mm-dd'); $model->EMP_RESIGN_DATE = $date; if ($model->save()) { $cari_user_login = Userlogin::find()->where(['EMP_ID' => $id])->one(); $baris = count($cari_user_login); if ($baris == 0) { } elseif ($model->EMP_STS == 3) { # code... $cari_user_login->status = 1; $cari_user_login->save(); } // upload only if valid uploaded file instance found if ($image !== false) { $path = $model->getImageFile(); $image->saveAs($path); } } return $this->redirect(['index', 'id' => $model->EMP_ID]); } } } }
/** * Creates a new User Login. * If creation is successful, the browser will be redirected to the 'index' page. * author wawan */ public function actionCreateUser() { $model = new Userlogin(); $user_profile = new UserProfile(); //componen user option $profile = Yii::$app->getUserOpt->Profile_user(); $usercreate = $profile->username; $model->scenario = Userlogin::SCENARIO_USER; if ($model->load(Yii::$app->request->post()) && $user_profile->load(Yii::$app->request->post())) { $post = Yii::$app->request->post(); $datapostion = $post['Userlogin']['POSITION_LOGIN']; if ($datapostion == 1) { $auth = "SALESMAN"; // auth key untuk salesmen } elseif ($datapostion == 2) { $auth = "SALES PROMOTION"; // auth key untuk sales promotion } elseif ($datapostion == 3) { $auth = "CUSTOMER"; // auth key untuk Customers } elseif ($datapostion == 4) { $auth = "DISTRIBUTOR"; // auth key untuk Customers } elseif ($datapostion == 5) { $auth = "FACTORY PABRIK"; // auth key untuk Customers } elseif ($datapostion == 6) { $auth = "OUTSOURCE"; // auth key untuk Customers } $model->POSITION_LOGIN = $datapostion; $model->POSITION_SITE = "CRM"; // untuk login crm $pass = $model->password_hash; $security = Yii::$app->security->generatePasswordHash($pass); $authkey = Yii::$app->security->generatePasswordHash($auth); $model->password_hash = $security; $model->auth_key = $authkey; $model->save(); $user_profile->ID_USER = $model->id; $user_profile->CREATED_BY = $usercreate; $user_profile->CREATED_AT = date("Y-m-d H:i:s"); $user_profile->save(); return $this->redirect(['index?tab=4']); } else { return $this->renderAjax('_usercreate', ['model' => $model, 'user_profile' => $user_profile]); } }
/** * Creates a new User Login. * If creation is successful, the browser will be redirected to the 'index' page. * quthor wawan */ public function actionCreateUser() { $model = new Userlogin(); $model->scenario = 'createuser'; if ($model->load(Yii::$app->request->post())) { $post = Yii::$app->request->post(); $datapostion = $post['Userlogin']['POSITION_LOGIN']; if ($datapostion == 1) { $auth = "SALESMAN"; // auth key untuk salesmen } else { $auth = "SALES PROMOTION"; // auth key untuk sales promotion } $model->POSITION_LOGIN = $datapostion; $model->POSITION_SITE = "CRM"; // untuk login crm $pass = $model->password_hash; $security = Yii::$app->security->generatePasswordHash($pass); $authkey = Yii::$app->security->generatePasswordHash($auth); $model->password_hash = $security; $model->auth_key = $authkey; $model->save(); return $this->redirect(['index']); } else { return $this->renderAjax('create', ['model' => $model]); } }
/** * CLASS TABLE FIND PrimaryKey * Example: Employe::find() */ protected function findModel($id) { if (($model = Userlogin::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function actionViewUserCrm($id) { $model = Userlogin::find()->where(['id' => $id])->one(); $user_profile_crm = Userprofile::find()->where(['ID' => $id])->one(); if ($model->load(Yii::$app->request->post()) || $user_profile_crm->load(Yii::$app->request->post())) { $model->email = $user_profile_crm->EMAIL; if ($user_profile_crm->STATUS == 0) { $model->status = 1; } elseif ($user_profile_crm->STATUS != 0) { $model->status = 10; } else { $model->status; } if ($model->save()) { $user_profile_crm->save(); return $this->redirect(['/master/schedule-header/index']); } } else { return $this->renderAjax('view_user_crm', ['model' => $model, 'user_profile_crm' => $user_profile_crm]); } }
<p> <?php echo Html::a('Create ERP Permission', ['create'], ['class' => 'btn btn-success']); ?> <!-- //echo "<a data-toggle="modal" href="#myModal" class="btn btn-primary btn-lg">Launch demo modal</a>"; --> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'USER_ID', 'format' => 'html', 'value' => function ($model) { $username = Userlogin::find()->where(['id' => $model->USER_ID])->one(); return Html::decode($username->username); }, 'filter' => ArrayHelper::map(Userlogin::find()->asArray()->all(), 'id', 'username')], ['attribute' => 'MODUL_ID', 'format' => 'html', 'value' => function ($model) { $MODUL_NM = Modulerp::find()->where(['MODUL_ID' => $model->MODUL_ID])->asArray()->one(); return Html::decode($MODUL_NM['MODUL_NM']); }, 'filter' => ArrayHelper::map(Modulerp::find()->asArray()->all(), 'MODUL_ID', 'MODUL_NM')], ['attribute' => 'STATUS', 'format' => 'html', 'value' => function ($model) { if ($model->STATUS == 0) { return Html::a('<i class="fa fa-lock"></i>'); } else { if ($model->STATUS == 1) { return Html::a('<i class="fa fa-unlock "></i>'); } } }], ['attribute' => 'BTN_CREATE', 'format' => 'html', 'value' => function ($model) { if ($model->BTN_CREATE == 0) { return Html::a('<i class="fa fa-lock"></i>'); } else { if ($model->BTN_CREATE == 1) {
protected function findModelUser($id) { if (($model = Userlogin::find()->where(['id' => $id])->one()) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
use kartik\builder\Form; use kartik\icons\Icon; $this->sideCorp = 'PT.Lukisongroup'; /* Title Select Company pada header pasa sidemenu/menu samping kiri */ $this->sideMenu = 'admin'; /* kd_menu untuk list menu pada sidemenu, get from table of database */ $this->title = Yii::t('app', 'ERP - Administrator'); /* title pada header page */ $username = Userlogin::find()->where(['id' => $model->USER_ID])->one(); $vUser = $username->username; $MODUL_NM = Modulerp::find()->where(['MODUL_ID' => $model->MODUL_ID])->one(); $vModul = $MODUL_NM->MODUL_NM; ?> <?php $attribute = ['ID', ['label' => 'UserName', 'attribute' => 'USER_ID', 'format' => 'raw', 'value' => Html::a($vUser), 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(Userlogin::find()->asArray()->all(), 'id', 'username'), 'options' => ['placeholder' => 'Select ...'], 'pluginOptions' => ['allowClear' => true]]], ['label' => 'MODUL ERP', 'attribute' => 'MODUL_ID', 'format' => 'raw', 'value' => Html::a($vModul), 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(Modulerp::find()->asArray()->all(), 'MODUL_ID', 'MODUL_NM'), 'options' => ['placeholder' => 'Select ...'], 'pluginOptions' => ['allowClear' => true]]], 'STATUS', 'CREATE', 'EDIT', 'TOMBOL1', 'TOMBOL2', 'TOMBOL3', 'TOMBOL4', 'TOMBOL5', 'TOMBOL6', 'TOMBOL7', 'TOMBOL8', 'TOMBOL9', 'TOMBOL10']; ?> </div class="body-content"> <div class="col-sm-3"> </div> <div class="col-sm-5"> <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); $grd1 = DetailView::widget(['model' => $model, 'condensed' => true, 'hover' => true, 'mode' => DetailView::MODE_VIEW, 'panel' => ['heading' => 'Permissio Request Order', 'type' => DetailView::TYPE_INFO], 'attributes' => $attribute]); Modal::begin(['id' => 'ro_permission_view']); echo $grd1; // refer the demo page for widget settings Modal::end(); ActiveForm::end(); ?> </div> </div>
/** * Finds record by [[EMP_ID]] * * @return EMP_ID|null * Also can use | $model = Employe::find()->where(['EMP_ID' => Yii::$app->user->identity->EMP_ID])->one(); */ public function getUserid() { if ($this->_userid === false) { $this->_userid = Userlogin::find()->where(['id' => Yii::$app->user->identity->id])->one(); } return $this->_userid; }
public function searchCust($params, $id) { /*[5.1] JOIN TABLE */ $query = Userlogin::find()->where(['id' => $id]); // ->where("POSITION_SITE='CRM'"); $dataProvider_Userlogin = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]); /*[5.3] LOAD VALIDATION PARAMS */ /*LOAD FARM VER 1*/ $this->load($params); if (!$this->validate()) { return $dataProvider_Userlogin; } /*[5.4] FILTER WHERE LIKE (string/integer)*/ /* FILTER COLUMN Author -ptr.nov-*/ $query->andFilterWhere(['like', 'username', $this->username]); return $dataProvider_Userlogin; }