/** * PilotprojectSearch searchEmp * @author ptrnov <*****@*****.**> * @since 1.1 */ public function searchEmp($params) { /*COMPONENT USER OPTION */ $profile = Yii::$app->getUserOpt->Profile_user(); //$query = Pilotproject::find()->Where('sc0001.STATUS<>3 AND CREATED_BY='. Yii::$app->user->identity->id .' AND DEP_ID="'.$this->gtDeptid() .'"'); //$query = Pilotproject::find()->Where('sc0001.STATUS<>3 AND CREATED_BY='. Yii::$app->user->identity->id .' AND DEP_ID="'.$this->getOptUser()->emp->DEP_ID .'"'); //$query = Pilotproject::find()->Where('sc0001.STATUS<>3 AND CREATED_BY='. Yii::$app->user->identity->id .' AND DEP_ID="'.Yii::$app->getUserOpt->Profile_user()->emp->DEP_ID .'"'); // $query = Pilotproject::find() // ->andWhere('sc0001.STATUS<>3 AND DEP_ID="'.$profile->emp->DEP_ID .'" AND CREATED_BY='. Yii::$app->user->identity->id) // ->orWhere('DESTINATION_TO='.$profile->emp->EMP_ID); $query = Pilotproject::find()->Where('sc0001.STATUS<>3 AND DESTINATION_TO="' . $profile->emp->EMP_ID . '"'); $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, 'PARENT' => $this->PARENT, 'SORT' => $this->SORT, 'PILOT_ID' => $this->PILOT_ID, 'PILOT_NM' => $this->PILOT_NM, 'DSCRP' => $this->DSCRP, 'PLAN_DATE1' => $this->PLAN_DATE1, 'PLAN_DATE2' => $this->PLAN_DATE2, 'ACTUAL_DATE1' => $this->ACTUAL_DATE1, 'ACTUAL_DATE2' => $this->ACTUAL_DATE2, 'DESTINATION_TO' => $this->DESTINATION_TO, 'BOBOT' => $this->BOBOT, 'STATUS' => $this->STATUS]); $query->andFilterWhere(['like', 'PILOT_NM', $this->PILOT_NM])->andFilterWhere(['like', 'CORP_ID', $this->CORP_ID])->andFilterWhere(['like', 'DEP_ID', $this->DEP_ID]); $query->orderby(['SORT' => SORT_ASC]); //SORT PENTING UNTUK RECURSIVE BIAR TREE BISA URUTAN, save => (IF (PATENT =0) {SORT=ID}, ELSE {SORT=PATENT}, note Parent=ID header return $dataProvider; }
/** * FUSIONCHAT GANTT PLAN ACTUAL * Status : Fixed, Dept. * ========== BACA ================ * UPDATE * Locate : Tab View Pilot Project. * 1. update Source : chart,categories * @since 1.1 * author piter novian [ptr.nov@gmail.com]. */ public function chartGanttPlanActual() { //***kategory Month $monthCtg = new ActiveDataProvider(['query' => Cnfmonth::find()->asArray(), 'pagination' => ['pageSize' => 24]]); //***kategory Week $weekCtg = new ActiveDataProvider(['query' => Cnfweek::find()->asArray(), 'pagination' => ['pageSize' => 200]]); //***get Data Pilotproject $_modalPilot = new ActiveDataProvider(['query' => Pilotproject::find()->Where(['CREATED_BY' => Yii::$app->user->identity->username])->orderBy('PLAN_DATE1')->asArray(), 'pagination' => ['pageSize' => 200]]); //***Task foreach ($_modalPilot->getModels() as $row => $value) { $taskCtg[] = ['label' => $value['PILOT_NM'], 'id' => strval($value['ID'])]; $taskPIC[] = ['label' => $value['CREATED_BY']]; } //***get plan actual pilot project $_modalActualPlan = new ArrayDataProvider(['allModels' => Yii::$app->db_widget->createCommand("\n\t\t\t\t\tSELECT *,x1.ID as IDX\n\t\t\t\t\tFROM sc0001 x1 RIGHT JOIN sc0001b x2 on x1.ENABLE_ACTUAL=x2.ENABLE_ACTUAL \n\t\t\t\t\tWHERE x2.ENABLE_ACTUAL=2 AND x1.CREATED_BY='" . Yii::$app->user->identity->username . "';\t\t\t\t\t\n\t\t\t")->queryAll(), 'pagination' => ['pageSize' => 400]]); $aryPlanActual = ArrayHelper::toArray($_modalActualPlan->getModels()); //***Task foreach ($aryPlanActual as $row => $value) { if ($value['ENABLE_NM'] == 'PLAN') { $task[] = ["label" => "Planned", "processid" => strval($value['IDX']), "start" => Yii::$app->formatter->asDatetime($value['PLAN_DATE1'], 'php:Y-m-d'), "end" => Yii::$app->formatter->asDatetime($value['PLAN_DATE2'], 'php:Y-m-d'), "id" => strval($value['IDX']) . "-1", "color" => "#008ee4", "height" => "32%", "toppadding" => "12%"]; } elseif ($value['ENABLE_NM'] == 'ACTUAL') { $task[] = ["label" => "Actual", "processid" => strval($value['IDX']), "start" => Yii::$app->formatter->asDatetime($value['ACTUAL_DATE1'], 'php:Y-m-d'), "end" => Yii::$app->formatter->asDatetime($value['ACTUAL_DATE2'], 'php:Y-m-d'), "id" => strval($value['IDX']), "color" => "#6baa01", "toppadding" => "56%", "height" => "32%"]; } } // print_r($task); // die(); $cntTask = sizeof($taskCtg); $maxRow = $cntTask <= 26 ? 26 - $cntTask : $cntTask; /* if($cntTask==0){ $maxRow=29; }elseif($cntTask<=29){ $maxRow=29-$cntTask; }else{ $maxRow=$cntTask; } */ for ($x = 0; $x <= $maxRow; $x++) { $taskCtgKosong[] = ['label' => '', 'id' => '']; } $mrgTaskCtg = ArrayHelper::merge($taskCtg, $taskCtgKosong); for ($x = 0; $x <= $maxRow; $x++) { $taskPICKosong[] = ['label' => '']; } $mrgtaskPIC = ArrayHelper::merge($taskPIC, $taskPICKosong); $rslt = '{ "chart": { "subcaption": "Pilot Project Planned vs Actual", "dateformat": "yyyy-mm-dd", "outputdateformat": "ddds mns yy", "ganttwidthpercent": "70", "ganttPaneDuration": "50", "ganttPaneDurationUnit": "d", "flatScrollBars": "0", "fontsize": "14", "exportEnabled": "1", "plottooltext": "$processName{br} $label starting date $start{br}$label ending date $end", "theme": "fint" }, "categories": [ { "bgcolor": "#33bdda", "align": "middle", "fontcolor": "#ffffff", "fontsize": "12", "category": ' . Json::encode($monthCtg->getModels()) . ' }, { "bgcolor": "#ffffff", "fontcolor": "#1288dd", "fontsize": "11", "isbold": "1", "align": "center", "category": ' . Json::encode($weekCtg->getModels()) . ' } ], "processes": { "headertext": "Pilot Task", "fontcolor": "#000000", "fontsize": "10", "isanimated": "1", "bgcolor": "#6baa01", "headervalign": "middle", "headeralign": "center", "headerbgcolor": "#6baa01", "headerfontcolor": "#ffffff", "headerfontsize": "12", "width":"200", "align": "left", "isbold": "1", "bgalpha": "25", "process": ' . Json::encode($mrgTaskCtg) . ' }, "datatable": { "headervalign": "bottom", "datacolumn": [ { "headertext": "PIC", "fontcolor": "#000000", "fontsize": "10", "isanimated": "1", "bgcolor": "#6baa01", "headervalign": "middle", "headeralign": "center", "headerbgcolor": "#6baa01", "headerfontcolor": "#ffffff", "headerfontsize": "12", "width":"100", "align": "left", "isbold": "1", "bgalpha": "25", "text": ' . Json::encode($mrgtaskPIC) . ' } ] }, "tasks": { "task":' . Json::encode($task) . ' } }'; return json::decode($rslt); }
protected function findParentIs($sort) { $parent = Pilotproject::find()->where(['SORT' => $sort])->one(); if ($parent->STATUS == 0) { return 'open'; } else { return 'close'; } }
/** * FUSIONCHAT GANTT PLAN ACTUAL * Status : Fixed, Dept. * ========== BACA ================ * UPDATE * Locate : Tab View Pilot Project. * 1. update Source : chart,categories * @since 1.1 * author piter novian [ptr.nov@gmail.com]. */ public function actionChartGanttPlanActual() { //***kategory Month $monthCtg = new ActiveDataProvider(['query' => Cnfmonth::find()->asArray(), 'pagination' => ['pageSize' => 24]]); $a = ArrayHelper::toArray($monthCtg->getModels()); $monthCategory = Json::encode($a); //***kategory Week $weekCtg = new ActiveDataProvider(['query' => Cnfweek::find(), 'pagination' => ['pageSize' => 200]]); $weekCategory = Json::encode($weekCtg->getModels()); //***get Data Pilotproject $_modalPilot = new ActiveDataProvider(['query' => Pilotproject::find()->Where(['CREATED_BY' => Yii::$app->user->identity->username]), 'pagination' => ['pageSize' => 200]]); //***Task $taskPIC = []; foreach ($_modalPilot->getModels() as $row => $value) { $taskCtg[] = ['label' => $value['PILOT_NM'], 'id' => $value['ID']]; $taskPIC = ['label' => $value['CREATED_BY']]; $task[] = ["label" => "Planned", "processid" => $value['ID'], "start" => Yii::$app->formatter->asDatetime($value['PLAN_DATE1'], 'php:d/m/Y'), "end" => Yii::$app->formatter->asDatetime($value['PLAN_DATE2'], 'php:d/m/Y'), "id" => $value['ID'] . "-1", "color" => "#008ee4", "height" => "32%", "toppadding" => "12%"]; } $dataTaskPic = Json::encode($taskPIC); $rslt = '{ "chart": { "subcaption": "Pilot Project Planned vs Actual", "dateformat": "dd/mm/yyyy", "outputdateformat": "ddds mns yy", "ganttwidthpercent": "70", "ganttPaneDuration": "50", "ganttPaneDurationUnit": "d", "height":"500%", "fontsize": "14", "plottooltext": "$processName{br} $label starting date $start{br}$label ending date $end", "theme": "fint" }, "categories": [ { "bgcolor": "#33bdda", "align": "middle", "fontcolor": "#ffffff", "fontsize": "12", "category": ' . $monthCategory . ' }, { "bgcolor": "#ffffff", "fontcolor": "#1288dd", "fontsize": "11", "isbold": "1", "align": "center", "category": ' . $weekCategory . ' } ], "processes": { "headertext": "Pilot Task", "fontsize": "12", "fontcolor": "#000000", "fontsize": "10", "isanimated": "1", "bgcolor": "#6baa01", "headervalign": "middle", "headeralign": "center", "headerbgcolor": "#6baa01", "headerfontcolor": "#ffffff", "headerfontsize": "16", "width":"200", "align": "left", "isbold": "1", "bgalpha": "25", "process": [ { } ] }, "datatable": { "headervalign": "bottom", "datacolumn": [ { "headertext": "PIC", "fontcolor": "#000000", "fontsize": "10", "isanimated": "1", "bgcolor": "#6baa01", "headervalign": "middle", "headeralign": "center", "headerbgcolor": "#6baa01", "headerfontcolor": "#ffffff", "headerfontsize": "16", "width":"150", "align": "left", "isbold": "1", "bgalpha": "25", "text": [ ] } ] }, }'; return $rslt; }
//'PILOT_ID', 'PILOT_NM', 'PLAN_DATE1', 'PLAN_DATE2', 'ACTUAL_DATE1', 'ACTUAL_DATE2', 'DSCRP', 'STATUS', ['class' => 'yii\grid\ActionColumn'] ] ]); */ $gv_pilot = GridView::widget(['id' => 'gv-pilot', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['label' => 'Header', 'attribute' => 'SORT', 'value' => function ($model, $key, $index, $widget) { $Proj_sort = Pilotproject::find()->where(['ID' => $model->SORT])->one(); return $Proj_sort->PILOT_NM; }, 'filter' => ArrayHelper::map(Pilotproject::find()->where('ID=SORT')->asArray()->all(), 'ID', 'PILOT_NM'), 'group' => true], ['label' => 'Sechedule', 'attribute' => 'PILOT_NM'], ['attribute' => 'PLAN_DATE1', 'filterType' => GridView::FILTER_DATE], ['attribute' => 'PLAN_DATE2', 'filterType' => GridView::FILTER_DATE], ['attribute' => 'BOBOT', 'format' => 'Html', 'value' => function ($model, $key, $index, $widget) { return StarRating::widget(['name' => 'rating_1']); }], ['attribute' => 'ACTUAL_DATE1', 'filterType' => GridView::FILTER_DATE], ['attribute' => 'ACTUAL_DATE2', 'filterType' => GridView::FILTER_DATE], ['label' => 'Discription', 'attribute' => 'DSCRP', 'mergeHeader' => true, 'value' => function ($model, $key, $index, $widget) { if ($model->DSCRP != '') { return substr($model->DSCRP, 0, 30) . ' ...'; //Author -ptr.nov- limit disply text } else { return ''; } }], ['label' => 'Status', 'attribute' => 'STATUS', 'format' => 'html', 'hAlign' => 'center', 'value' => function ($model) { if ($model->STATUS == 0) { return Html::a('<i class="fa fa-edit"></i> Open', '', ['class' => 'btn btn-success btn-sm', 'title' => 'Open']); } else { if ($model->STATUS == 1) { return Html::a('<i class="fa fa-close"></i> Close', '', ['class' => 'btn btn-danger btn-sm', 'title' => 'Closing']); }
return tombolClose($url, $model); }]]], 'pjax' => true, 'pjaxSettings' => ['options' => ['enablePushState' => false, 'id' => 'gv-pilot']], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-plus"></i>', ['createparent'], ['data-toggle' => "modal", 'data-target' => "#gv-pilotp-create", 'type' => 'button', 'class' => 'btn btn-success']) . ' ' . Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['grid-demo'], ['class' => 'btn btn-default', ''])], '{export}', '{toggleData}'], 'panel' => ['type' => 'info', 'heading' => 'Pilot Project'], 'hover' => true, 'responsive' => true, 'bordered' => true, 'striped' => true, 'autoXlFormat' => true, 'export' => ['fontAwesome' => true, 'showConfirmAlert' => false]]); /** * GridView CRUD Pilot Project Employe ActiveRecord Data * * @author ptrnov <*****@*****.**> * @since 1.1 * id_user=1 [user id login] * pilih=1 [0=department;1=user aktif] * @link https://github.com/C12D/advanced/blob/master/lukisongroup/view/widget/pilotp/index.php * @see https://github.com/C12D/advanced/blob/master/lukisongroup/view/widget/pilotp/index.php */ $gv_pilotEmp = GridView::widget(['id' => 'gv-pilot-emp', 'dataProvider' => $dataProviderEmp, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['label' => 'Header', 'attribute' => 'SORT', 'value' => function ($model, $key, $index, $widget) { $Proj_sort = Pilotproject::find()->where(['ID' => $model->SORT])->one(); return $Proj_sort->PILOT_NM; }, 'filter' => ArrayHelper::map(Pilotproject::find()->where('ID=SORT')->asArray()->all(), 'ID', 'PILOT_NM'), 'group' => true], ['label' => 'Sechedule', 'attribute' => 'PILOT_NM'], ['attribute' => 'PLAN_DATE1', 'filterType' => GridView::FILTER_DATE], ['attribute' => 'PLAN_DATE2', 'filterType' => GridView::FILTER_DATE], ['attribute' => 'ACTUAL_DATE1', 'filterType' => GridView::FILTER_DATE], ['attribute' => 'ACTUAL_DATE2', 'filterType' => GridView::FILTER_DATE], ['label' => 'Discription', 'attribute' => 'DSCRP', 'mergeHeader' => true, 'value' => function ($model, $key, $index, $widget) { if ($model->DSCRP != '') { return substr($model->DSCRP, 0, 30) . ' ...'; //Author -ptr.nov- limit disply text } else { return ''; } }], ['label' => 'Status', 'attribute' => 'STATUS', 'format' => 'html', 'hAlign' => 'center', 'value' => function ($model) { if ($model->STATUS == 0) { return Html::a('<i class="fa fa-edit"></i> Open', '', ['class' => 'btn btn-success btn-sm', 'title' => 'Open']); } else { if ($model->STATUS == 1) { return Html::a('<i class="fa fa-close"></i> Close', '', ['class' => 'btn btn-danger btn-sm', 'title' => 'Closing']); } } }, 'filter' => ['0' => 'Open', '1' => 'Close']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {create} {update}', 'header' => 'Action', 'buttons' => ['view' => function ($url, $model, $key) {