예제 #1
0
 public function search($params)
 {
     /*[5.1] JOIN TABLE */
     $query = Employe::find()->JoinWith('corpOne', true, 'LEFT JOIN')->JoinWith('deptOne', true, 'left JOIN')->JoinWith('jabOne', true, 'left JOIN')->JoinWith('sttOne', true, 'left JOIN')->where(['a0001.status' => 0]);
     /* SUB JOIN*/
     //$query->leftJoin(['company'=>$queryCop],'company.CORP_ID=a0001.EMP_CORP_ID');//->orderBy(['company.CORP_ID'=>SORT_ASC]);
     //->andFilterWhere(['EMP_ID'=>'006']);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     /*[5.2] SHORTING */
     /* SORTING CORPORATE Author -ptr.nov-*/
     $dataProvider->sort->attributes['corpOne.CORP_NM'] = ['asc' => ['a0001.CORP_NM' => SORT_ASC], 'desc' => ['a0001.CORP_NM' => SORT_DESC]];
     /* SORTING DEPARTMENT Author -ptr.nov-*/
     $dataProvider->sort->attributes['deptOne.DEP_NM'] = ['asc' => ['a0002.DEP_NM' => SORT_ASC], 'desc' => ['a0002.DEP_NM' => SORT_DESC]];
     /* SORTING JABATAN Author -ptr.nov-*/
     $dataProvider->sort->attributes['jabOne.JAB_NM'] = ['asc' => ['a0003.JAB_NM' => SORT_ASC], 'desc' => ['a0003.JAB_NM' => SORT_DESC]];
     /* SORTING STATUS Author -ptr.nov-*/
     $dataProvider->sort->attributes['sttOne.STS_NM'] = ['asc' => ['b0009.STS_NM' => SORT_ASC], 'desc' => ['b0009.STS_NM' => SORT_DESC]];
     /*[5.3] LOAD VALIDATION PARAMS */
     /*LOAD FARM VER 1*/
     $this->load($params);
     if (!$this->validate()) {
         return $dataProvider;
     }
     /*LOAD FARM VER 2*/
     // if (!($this->load($params) && $this->validate()))
     //return $dataProvider;
     /*[5.4] FILTER WHERE LIKE (string/integer)*/
     /* FILTER COLUMN Author -ptr.nov-*/
     $query->andFilterWhere(['like', 'EMP_ID', $this->EMP_ID])->andFilterWhere(['like', 'EMP_NM', $this->EMP_NM])->andFilterWhere(['like', 'EMP_NM_BLK', $this->EMP_NM_BLK])->andFilterWhere(['like', 'b0009.STS_NM', $this->getAttribute('sttOne.STS_NM')])->andFilterWhere(['like', 'a0001.CORP_NM', $this->getAttribute('corpOne.CORP_NM')])->andFilterWhere(['like', 'a0002.DEP_NM', $this->getAttribute('deptOne.DEP_NM')])->andFilterWhere(['like', 'a0003.JAB_NM', $this->getAttribute('jabOne.JAB_NM')])->andFilterWhere(['like', 'b0009.STS_NM', $this->getAttribute('sttOne.STS_NM')]);
     /*[5.4] FILTER WHERE LIKE (date)*/
     /* FILTER COLUMN DATE RANGE Author -ptr.nov-*/
     if (isset($this->EMP_JOIN_DATE) && $this->EMP_JOIN_DATE != '') {
         $date_explode = explode("TO", $this->EMP_JOIN_DATE);
         $date1 = trim($date_explode[0]);
         $date2 = trim($date_explode[1]);
         $query->andFilterWhere(['between', 'a0001.EMP_JOIN_DATE', $date1, $date2]);
     }
     return $dataProvider;
 }
예제 #2
0
파일: _form_view.php 프로젝트: ptrnov/WND-W
<?php

use yii\helpers\Html;
use app\models\hrd\Corp;
use app\models\hrd\Dept;
use app\models\hrd\Jabatan;
use app\models\hrd\Status;
use app\models\hrd\Employe;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kartik\builder\FormGrid;
use kartik\widgets\FileInput;
use yii\helpers\ArrayHelper;
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL]);
//$form = ActiveForm::begin(['type'=>ActiveForm::TYPE_VERTICAL]);
$nlDigit = Employe::find()->count() + 1;
$nl = 'LG' . $nlDigit;
echo FormGrid::widget(['model' => $model, 'form' => $form, 'autoGenerateColumns' => true, 'rows' => [['contentBefore' => '<legend class="text-info"><small>EMPLOYE IDENTITY</small></legend>', 'columns' => 1, 'autoGenerateColumns' => false, 'attributes' => ['employe_identity' => ['label' => 'Employee.ID', 'columns' => 5, 'attributes' => ['EMP_ID' => ['type' => Form::INPUT_TEXT, 'Form::SIZE_LARGE', 'options' => ['value' => $nl], 'columnOptions' => ['colspan' => 3]], 'EMP_NM' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter First Name...'], 'columnOptions' => ['colspan' => 4]], 'EMP_NM_BLK' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Last Name...'], 'columnOptions' => ['colspan' => 4]]]]]], ['contentBefore' => '<legend class="text-info"><small>CORPORATE IDENTITY</small></legend>', 'columns' => 2, 'autoGenerateColumns' => false, 'attributes' => ['employe_identity' => ['label' => 'Company', 'columns' => 2, 'attributes' => ['EMP_CORP_ID' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Corp::find()->orderBy('SORT')->asArray()->all(), 'CORP_ID', 'CORP_NM'), 'columnOptions' => ['colspan' => 1]], 'DEP_ID' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Dept::find()->orderBy('SORT')->asArray()->all(), 'DEP_ID', 'DEP_NM'), 'hint' => 'Select Department', 'columnOptions' => ['colspan' => 1]], 'JAB_ID' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Jabatan::find()->orderBy('SORT')->asArray()->all(), 'JAB_ID', 'JAB_NM'), 'hint' => 'Select	Position ', 'columnOptions' => ['colspan' => 1]], 'EMP_STS' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Status::find()->orderBy('SORT')->asArray()->all(), 'STS_ID', 'STS_NM'), 'hint' => 'Select Employee Status', 'columnOptions' => ['colspan' => 1]], 'EMP_JOIN_DATE' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\DatePicker', 'options' => ['pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd', 'todayHighlight' => true]], 'hint' => 'Enter Join Date (yyyy-mm-dd)', 'columnOptions' => ['colspan' => 1]], 'EMP_RESIGN_DATE' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\DatePicker', 'options' => ['pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd', 'todayHighlight' => true]], 'hint' => 'Enter Resign Date (yyyy-mm-dd)', 'columnOptions' => ['colspan' => 1]]]]]], ['contentBefore' => '<legend class="text-info"><small>EMPLOYEE PROFILE</small></legend>', 'columns' => 3, 'autoGenerateColumns' => false, 'attributes' => ['address_detail' => ['label' => 'Address', 'columns' => 6, 'attributes' => ['EMP_KTP' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter NO KTP...'], 'columnOptions' => ['colspan' => 2]], 'EMP_ALAMAT' => ['type' => Form::INPUT_TEXTAREA, 'options' => ['placeholder' => 'Enter address...'], 'columnOptions' => ['colspan' => 6]], 'EMP_ZIP' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Zip...'], 'columnOptions' => ['colspan' => 1]], 'EMP_HP' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Phone...'], 'columnOptions' => ['colspan' => 2]], 'EMP_GENDER' => ['type' => Form::INPUT_RADIO_LIST, 'items' => ['Male' => 'Male', 'Female' => 'Female'], 'options' => ['inline' => 'Male'], 'columnOptions' => ['colspan' => 4]], 'EMP_TGL_LAHIR' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\DatePicker', 'options' => ['pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd', 'todayHighlight' => true]], 'hint' => 'Enter birthday  (yyyy-mm-dd)', 'columnOptions' => ['colspan' => 3]], 'EMP_EMAIL' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'acount@domain.com...', 'addon' => ['prepend' => ['content' => '@']]], 'columnOptions' => ['colspan' => 3]]]]]], ['columns' => 3, 'attributes' => ['address_detail' => ['label' => 'Picture', 'columns' => 6, 'attributes' => ['EMP_IMG' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\FileInput', 'columnOptions' => ['colspan' => 2]]]]]], ['attributes' => ['actions' => ['type' => Form::INPUT_RAW, 'value' => '<div style="text-align: right; margin-top: 20px">' . Html::resetButton('Reset', ['class' => 'btn btn-default']) . ' ' . Html::submitButton('Submit', ['class' => 'btn btn-primary']) . '</div>']]]]]);
ActiveForm::end();
예제 #3
0
파일: Pendidikan.php 프로젝트: ptrnov/WND-W
 public function getEmp()
 {
     return $this->hasOne(Employe::className(), ['EMP_ID' => 'EMP_ID']);
 }
예제 #4
0
파일: _form.php 프로젝트: ptrnov/WND-W
use app\models\hrd\Employe;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kartik\builder\FormGrid;
use kartik\widgets\FileInput;
use yii\helpers\ArrayHelper;
use lukisongroup\models\system\side_menu\M1000;
use kartik\sidenav\SideNav;
use kartik\markdown\Markdown;
$this->mddPage = 'hrd';
//$form = ActiveForm::begin(['type'=>ActiveForm::TYPE_HORIZONTAL]);
//$form = ActiveForm::begin(['type'=>ActiveForm::TYPE_VERTICAL]);
/*Author: -ptr.nov- Generate digit EMP_ID */
/*Get Id count Author:-ptr.nov-*/
//$cnt= (Employe::find()->count())+1;
/*get ID Sparator Array , Author: -ptr.nov-*/
$sql = 'SELECT max(EMP_ID) as EMP_ID FROM a0001';
$cnt = Employe::findBySql($sql)->one();
$arySplit = explode('.', $cnt->EMP_ID);
$str_id_cnt = trim($arySplit[2]);
//print_r($str_id_cnt+1);
$id_cnt = $str_id_cnt + 1;
/*Combine String and Digit Author: -ptr.nov- */
$digit = str_pad($id_cnt, 4, "0", STR_PAD_LEFT);
$thn = date("Y");
$nl = 'LG' . '.' . $thn . '.' . $digit;
/*Author: Eka Side Menu */
$side_menu = \yii\helpers\Json::decode(M1000::find()->findMenu('hrd')->one()->jval);
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]);
echo FormGrid::widget(['model' => $model, 'form' => $form, 'autoGenerateColumns' => true, 'rows' => [['contentBefore' => '<legend class="text-info"><small>EMPLOYE IDENTITY</small></legend>', 'columns' => 1, 'autoGenerateColumns' => false, 'attributes' => ['employe_identity' => ['label' => 'Employee.ID', 'columns' => 5, 'attributes' => ['EMP_ID' => ['type' => Form::INPUT_TEXT, 'Form::SIZE_LARGE', 'options' => ['value' => $nl], 'columnOptions' => ['colspan' => 3]], 'EMP_NM' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter First Name...'], 'columnOptions' => ['colspan' => 4]], 'EMP_NM_BLK' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Last Name...'], 'columnOptions' => ['colspan' => 4]]]]]], ['contentBefore' => '<legend class="text-info"><small>CORPORATE IDENTITY</small></legend>', 'columns' => 2, 'autoGenerateColumns' => false, 'attributes' => ['employe_identity' => ['label' => 'Company', 'columns' => 2, 'attributes' => ['EMP_CORP_ID' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Corp::find()->orderBy('SORT')->asArray()->all(), 'CORP_ID', 'CORP_NM'), 'columnOptions' => ['colspan' => 1]], 'DEP_ID' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Dept::find()->orderBy('SORT')->asArray()->all(), 'DEP_ID', 'DEP_NM'), 'hint' => 'Select Department', 'columnOptions' => ['colspan' => 1]], 'JAB_ID' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Jabatan::find()->orderBy('SORT')->asArray()->all(), 'JAB_ID', 'JAB_NM'), 'hint' => 'Select	Position ', 'columnOptions' => ['colspan' => 1]], 'EMP_STS' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Status::find()->orderBy('SORT')->asArray()->all(), 'STS_ID', 'STS_NM'), 'hint' => 'Select Employee Status', 'columnOptions' => ['colspan' => 1]], 'EMP_JOIN_DATE' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\DatePicker', 'options' => ['pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd', 'todayHighlight' => true]], 'hint' => 'Enter Join Date (yyyy-mm-dd)', 'columnOptions' => ['colspan' => 1]], 'EMP_RESIGN_DATE' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\DatePicker', 'options' => ['pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd', 'todayHighlight' => true]], 'hint' => 'Enter Resign Date (yyyy-mm-dd)', 'columnOptions' => ['colspan' => 1]]]]]], ['contentBefore' => '<legend class="text-info"><small>EMPLOYEE PROFILE</small></legend>', 'columns' => 3, 'autoGenerateColumns' => false, 'attributes' => ['address_detail' => ['label' => 'Address', 'columns' => 6, 'attributes' => ['EMP_KTP' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter NO KTP...'], 'columnOptions' => ['colspan' => 2]], 'EMP_ALAMAT' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => 'kartik\\markdown\\MarkdownEditor', 'columnOptions' => ['colspan' => 6]], 'EMP_ZIP' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Zip...'], 'columnOptions' => ['colspan' => 1]], 'EMP_HP' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Phone...'], 'columnOptions' => ['colspan' => 2]], 'EMP_GENDER' => ['type' => Form::INPUT_RADIO_LIST, 'items' => ['Male' => 'Male', 'Female' => 'Female'], 'options' => ['inline' => 'Male'], 'columnOptions' => ['colspan' => 4]], 'EMP_TGL_LAHIR' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\DatePicker', 'options' => ['pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd', 'todayHighlight' => true]], 'hint' => 'Enter birthday  (yyyy-mm-dd)', 'columnOptions' => ['colspan' => 3]], 'EMP_EMAIL' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'acount@domain.com...', 'addon' => ['prepend' => ['content' => '@']]], 'columnOptions' => ['colspan' => 3]]]]]], ['columns' => 3, 'attributes' => ['address_detail' => ['label' => 'Picture', 'columns' => 6, 'attributes' => ['upload_file' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\FileInput', 'options' => ['pluginOptions' => ['showPreview' => true, 'showCaption' => false, 'showRemove' => false, 'showUpload' => false]], 'columnOptions' => ['colspan' => 2]]]]]], ['attributes' => ['actions' => ['type' => Form::INPUT_RAW, 'value' => '<div style="text-align: right; margin-top: 20px">' . Html::resetButton('Reset', ['class' => 'btn btn-default']) . ' ' . Html::submitButton('Submit', ['class' => 'btn btn-primary']) . '</div>']]]]]);
ActiveForm::end();