Esempio n. 1
0
 public function get_aryUserCrmSales()
 {
     $sql = Userlogin::find()->with('crmUserprofileTbl')->where('POSITION_SITE="CRM" AND POSITION_ACCESS = 2 AND status <>1')->all();
     return ArrayHelper::map($sql, 'id', function ($sql, $defaultValue) {
         return $sql->username . ' - ' . $sql->crmUserprofileTbl->NM_FIRST;
     });
 }
 /**
  * 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;
 }
 /**
  * Lists all Scheduleheader models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new ScheduleheaderSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $searchModelUser = new UserloginSearch();
     $dataProviderUser = $searchModelUser->searchCustGroup(Yii::$app->request->queryParams);
     $model = new Scheduleheader();
     // data select2 for SCDL_GROUP
     $query = Schedulegroup::find()->all();
     $datagroup = ArrayHelper::map($query, 'ID', 'SCDL_GROUP_NM');
     // data select2 for USER_ID where CRM and STATUS 10(active)
     $query1 = Userlogin::find()->where('POSITION_SITE = "CRM" AND STATUS = 10')->all();
     $datauser = ArrayHelper::map($query1, 'id', 'username');
     return $this->render('index', ['dataProviderUser' => $dataProviderUser, 'searchModelUser' => $searchModelUser, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'model' => $model, 'datagroup' => $datagroup, 'datauser' => $datauser]);
 }
Esempio n. 4
0
 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;
 }
Esempio n. 5
0
 /**
  * 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 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);
 }
Esempio n. 7
0
 /**
  *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]);
             }
         }
     }
 }
 public function get_aryUserSalesmanager()
 {
     $sql = Userlogin::find()->with('emp')->where('  POSITION_ACCESS = 1 AND status <>1')->all();
     return ArrayHelper::map($sql, 'username', function ($sql, $defaultValue) {
         return $sql->emp->EMP_NM . ' - ' . $sql->emp->EMP_NM_BLK;
     });
 }
 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]);
     }
 }
Esempio n. 10
0
    <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.');
     }
 }
Esempio n. 12
0
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;
 }
Esempio n. 14
0
 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;
 }