/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = EmpDepartment::find()->where(['is_status' => 0]); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['emp_department_id' => SORT_DESC]]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['emp_department_id' => $this->emp_department_id, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by, 'is_status' => $this->is_status]); $query->andFilterWhere(['like', 'emp_department_name', $this->emp_department_name])->andFilterWhere(['like', 'emp_department_alias', $this->emp_department_alias]); unset($_SESSION['exportData']); $_SESSION['exportData'] = $dataProvider; return $dataProvider; }
} } } } } } } echo "</tr>"; $i = 1; $m = 1; foreach ($employee_data as $t => $sd) { echo "<tr>"; echo "<td class='text-center'>" . $i . "</td>"; foreach ($selected_list as $s) { if ($s == 'emp_department_name') { echo "<td class='text-center'>" . EmpDepartment::findOne($sd['emp_master_department_id'])->emp_department_name . "</td>"; } else { if ($s == 'city') { if ($sd['emp_master_emp_address_id'] != 0) { $add = EmpAddress::findOne($sd['emp_master_emp_address_id']); if ($add->emp_cadd_city != null) { echo "<td class='text-center'>" . City::findOne($add->emp_cadd_city)->city_name . "</td>"; } else { echo "<td> </td>"; } } else { echo "<td> </td>"; } } else { if ($s == 'emp_designation_name') { if ($sd['emp_master_designation_id'] != null) {
} } } echo "</tr>"; $i = 1; foreach ($employee_data as $t => $sd) { if ($i % 2 == 0) { $bgcolor = "#FFFFFF"; } else { $bgcolor = "#E3E3E3"; } echo '<tr align=center bgcolor=' . $bgcolor . '>'; echo "<td style='align:center; valign:'middle';'>" . $i . "</td>"; foreach ($selected_list as $s) { if ($s == 'emp_department_name') { echo "<td style='align:center; valign:'middle';'>" . EmpDepartment::findOne($sd['emp_master_department_id'])->emp_department_name . "</td>"; } else { if ($s == 'emp_designation_name') { if ($sd['emp_master_designation_id'] != null) { echo "<td class='text-center'>" . EmpDesignation::findOne($sd['emp_master_designation_id'])->emp_designation_name . "</td>"; } else { echo "<td > </td>"; } } else { if ($s == 'city') { if ($sd['emp_master_emp_address_id'] != 0) { $add = EmpAddress::findOne($sd['emp_master_emp_address_id']); if ($add->emp_cadd_city != null) { echo "<td style='align:center; valign:'middle';'>" . City::findOne($add->emp_cadd_city)->city_name . "</td>"; } else { echo "<td> </td>";
public function actionIndex() { $fYearWiseAdm = []; /** * @Start Display Category Wise Student Details Graph */ $stuCateDataTmp = StuCategory::find()->where(['is_status' => 0])->asArray()->all(); foreach ($stuCateDataTmp as $cv) { $stuCatWiseDisp[] = $cv['stu_category_name']; $maleCount = (new \yii\db\Query())->from('stu_master sm')->join('JOIN', 'stu_info si', 'si.stu_info_stu_master_id = sm.stu_master_id')->where(['sm.is_status' => '0', 'si.stu_gender' => 'Male', 'sm.stu_master_category_id' => $cv['stu_category_id']])->count(); $femaleCount = (new \yii\db\Query())->from('stu_master sm')->join('JOIN', 'stu_info si', 'si.stu_info_stu_master_id = sm.stu_master_id')->where(['sm.is_status' => '0', 'si.stu_gender' => 'Female', 'sm.stu_master_category_id' => $cv['stu_category_id']])->count(); $stuCatWiseDataMale[] = $maleCount; $stuCatWiseDataFemale[] = $femaleCount; } $stuCatWiseDisp[] = 'Not Set'; $stuCatWiseDataMale[] = (new \yii\db\Query())->from('stu_master sm')->join('JOIN', 'stu_info si', 'si.stu_info_stu_master_id = sm.stu_master_id')->where(['sm.is_status' => 0, 'sm.stu_master_category_id' => NULL, 'si.stu_gender' => 'Male'])->count(); $stuCatWiseDataFemale[] = (new \yii\db\Query())->from('stu_master sm')->join('JOIN', 'stu_info si', 'si.stu_info_stu_master_id = sm.stu_master_id')->where(['sm.is_status' => 0, 'sm.stu_master_category_id' => NULL, 'si.stu_gender' => 'Female'])->count(); /** * @Start Display Student Status Wise Details in combine graph */ $dataRegTmp = $courseData = []; $stuRegStat = StuMaster::find()->where(['is_status' => 0, 'stu_master_stu_status_id' => 0])->count(); $stuStatusWise[] = ['name' => "Default ({$stuRegStat})", 'y' => $stuRegStat, 'color' => '#77C730']; $courseDataTmp = Courses::find()->where(['is_status' => 0])->asArray()->limit(10)->orderBy('course_id DESC')->all(); $stuStatusDataTmp = StuStatus::find()->where(['is_status' => 0])->orderBy('stu_status_id')->asArray()->all(); foreach ($courseDataTmp as $v) { $stuCourseRegStat = StuMaster::find()->where(['is_status' => 0, 'stu_master_stu_status_id' => 0, 'stu_master_course_id' => $v['course_id']])->count(); $dataRegTmp[] = $stuCourseRegStat; $courseData[] = $v['course_name']; } $stuStatusData[] = ['name' => "Default ({$stuRegStat})", 'type' => 'column', 'data' => $dataRegTmp, 'color' => '#77C730']; //print_r($stuStatusData); exit; foreach ($stuStatusDataTmp as $k => $sv) { $dataTmp = []; foreach ($courseDataTmp as $v) { $stuCourseStat = StuMaster::find()->where(['is_status' => 0, 'stu_master_course_id' => $v['course_id'], 'stu_master_stu_status_id' => $sv['stu_status_id']])->count(); $dataTmp[] = $stuCourseStat; } $stuStatusWiseCount = StuMaster::find()->where(['is_status' => 0, 'stu_master_stu_status_id' => $sv['stu_status_id']])->count(); $stuStatusData[] = ['name' => $sv['stu_status_name'] . "({$stuStatusWiseCount})", 'type' => 'column', 'data' => $dataTmp]; $stuStatusWise[] = ['name' => $sv['stu_status_name'] . ' (' . $stuStatusWiseCount . ')', 'y' => $stuStatusWiseCount, 'color' => new JsExpression('Highcharts.getOptions().colors[' . $k . ']')]; } /** * @Start Gender Wise Data Display For Student */ $stuGenWise = (new \yii\db\Query())->select(["CONCAT(IFNULL(si.stu_gender, 'Not Set'), ' (', COUNT( stu_master_id ), ')') AS '0'", 'COUNT(stu_master_id) AS "1"'])->from('stu_master sm')->join('JOIN', 'stu_info si', 'si.stu_info_stu_master_id = sm.stu_master_id')->where(['sm.is_status' => '0'])->groupBy('si.stu_gender')->orderBy('si.stu_gender ASC')->all(); if ($stuGenWise) { $stuGenWise[0][0] = "Not Set" . $stuGenWise[0][0]; } /** * @Start Gender Wise Data Display For Employee */ $empGenWise = (new \yii\db\Query())->select(["CONCAT(IFNULL(ei.emp_gender, 'Not Set'), ' (', COUNT( emp_master_id ), ')') AS '0'", 'COUNT(emp_master_id) AS "1"'])->from('emp_master em')->join('JOIN', 'emp_info ei', 'ei.emp_info_emp_master_id = em.emp_master_id')->where(['em.is_status' => '0'])->groupBy('ei.emp_gender')->orderBy('ei.emp_gender ASC')->all(); if ($empGenWise) { $empGenWise[0][0] = "Not Set" . $empGenWise[0][0]; } /** * @Start Year wise employee joining */ $empYearWiseJoin = $depDisp = []; $empYearJoin = (new \yii\db\Query())->select(["CONCAT(DATE_FORMAT(ei.emp_joining_date, '%Y'), ' (', COUNT(em.emp_master_id), ')') AS 'yearDisp'", 'DATE_FORMAT(ei.emp_joining_date, "%Y") as "year"'])->from('emp_master em')->join('JOIN', 'emp_info ei', 'ei.emp_info_emp_master_id = em.emp_master_id')->where(['em.is_status' => '0'])->groupBy(['DATE_FORMAT(ei.emp_joining_date, "%Y")'])->orderBy('YEAR(ei.emp_joining_date) DESC')->limit('3')->all(); foreach ($empYearJoin as $k => $v) { $yearResults = $deptCount = $depDisp = []; $deptData = \app\modules\employee\models\EmpDepartment::find()->where(['is_status' => 0])->limit(10)->orderBy('emp_department_id DESC')->asArray()->all(); foreach ($deptData as $k => $dv) { $deptCountTmp = (new \yii\db\Query())->from('emp_master em')->join('JOIN', 'emp_info ei', 'ei.emp_info_emp_master_id = em.emp_master_id')->where(['YEAR(ei.emp_joining_date)' => $v['year'], 'emp_master_department_id' => $dv['emp_department_id'], 'is_status' => 0])->count(); $deptCount[] = $deptCountTmp; $depDisp[] = $dv['emp_department_alias']; } $yearResults = ['name' => !empty($v['yearDisp']) ? $v['yearDisp'] : "Not Set", 'data' => $deptCount]; $empYearWiseJoin[] = $yearResults; } return $this->render('index', ['stuCatWiseDataMale' => $stuCatWiseDataMale, 'stuCatWiseDataFemale' => $stuCatWiseDataFemale, 'stuCatWiseDisp' => $stuCatWiseDisp, 'stuStatusWise' => $stuStatusWise, 'stuGenWise' => $stuGenWise, 'empYearWiseJoin' => $empYearWiseJoin, 'depDisp' => $depDisp, 'courseData' => $courseData, 'stuStatusData' => $stuStatusData, 'empGenWise' => $empGenWise]); }
/** * Finds the EmpDepartment model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return EmpDepartment the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = EmpDepartment::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getEmpMasterDepartment() { return $this->hasOne(EmpDepartment::className(), ['emp_department_id' => 'emp_master_department_id']); }
<div class="box box-solid box-info"> <div class="box-header with-border"> <h4 class="box-title"><i class="fa fa-search"></i> Select Criteria</h4> </div> <?php $form = ActiveForm::begin(['id' => 'emp-report-view-form']); ?> <div class="box-body"> <div class="row"> <div class="col-xs-12 col-sm-4 col-lg-4 form-group"> <?php echo Html::label('Department', '', ['class' => 'control-label']); ?> <span style='color:red;'> * </span> <?php echo Html::dropDownList('department', null, ArrayHelper::map(\app\modules\employee\models\EmpDepartment::find()->where(['is_status' => 0])->all(), 'emp_department_id', 'emp_department_name'), ['prompt' => 'Select Department', 'class' => 'form-control', 'required' => true]); ?> </div> <div class="col-xs-12 col-sm-4 col-lg-4 form-group"> <?php echo Html::label('Designation', '', ['class' => 'control-label']); ?> <?php echo Html::dropDownList('designation', null, ArrayHelper::map(\app\modules\employee\models\EmpDesignation::find()->where(['is_status' => 0])->all(), 'emp_designation_id', 'emp_designation_name'), ['prompt' => 'Select Designation', 'class' => 'form-control']); ?> </div> <div class="col-xs-12 col-sm-4 col-lg-4 form-group"> <?php echo Html::label('Category', ''); ?> <?php
?> </div> </div> </div> <div class="col-xs-12" style="padding-top: 10px;"> <div class="box"> <div class="box-header"> </div><!-- /.box-header --> <div class="box-body table-responsive"> <div class="emp-master-index"> <?php $visible = Yii::$app->user->can("/employee/emp-master/view") ? true : false; ?> <?php Pjax::begin(['enablePushState' => false]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'summary' => '', 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['label' => 'Employee ID', 'attribute' => 'emp_unique_id', 'value' => 'empMasterEmpInfo.emp_unique_id'], ['label' => 'First Name', 'attribute' => 'emp_first_name', 'value' => 'empMasterEmpInfo.emp_first_name'], ['label' => 'Middle Name', 'attribute' => 'emp_middle_name', 'value' => 'empMasterEmpInfo.emp_middle_name'], ['label' => 'Last Name', 'attribute' => 'emp_last_name', 'value' => 'empMasterEmpInfo.emp_last_name'], ['label' => 'Department', 'attribute' => 'emp_master_department_id', 'value' => 'empMasterDepartment.emp_department_name', 'filter' => ArrayHelper::map(app\modules\employee\models\EmpDepartment::find()->where(['is_status' => 0])->all(), 'emp_department_id', 'emp_department_name')], ['label' => 'Designation', 'attribute' => 'emp_master_designation_id', 'value' => 'empMasterDesignation.emp_designation_name', 'filter' => ArrayHelper::map(app\modules\employee\models\EmpDesignation::find()->where(['is_status' => 0])->all(), 'emp_designation_id', 'emp_designation_name')], ['label' => 'Category', 'attribute' => 'emp_master_category_id', 'value' => 'empMasterCategory.emp_category_name', 'filter' => ArrayHelper::map(app\modules\employee\models\EmpCategory::find()->where(['is_status' => 0])->all(), 'emp_category_id', 'emp_category_name')], ['class' => 'app\\components\\CustomActionColumn', 'template' => '{view}{delete}', 'buttons' => ['view' => function ($url, $model) { return Yii::$app->user->can("/employee/emp-master/view") ? Html::a('<span class="glyphicon glyphicon-search"></span>', $url, ['title' => Yii::t('app', 'View')]) : ''; }, 'delete' => function ($url, $model) { return Yii::$app->user->can("/employee/emp-master/delete") ? Html::a('<span class="glyphicon glyphicon-remove"></span>', $url, ['title' => Yii::t('app', 'Delete'), 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]) : ''; }], 'visible' => $visible]]]); ?> <?php Pjax::end(); ?> </div></div></div></div>
use app\modules\employee\models\EmpDesignation; ?> <div class="grid-view user-data"> <?php if (!empty($employee_data)) { $emp_info = new EmpInfo(); echo "</br></br><h3>Employee List</h3>"; $i = 1; foreach ($employee_data as $t => $sd) { echo "<h3>" . $sd['emp_first_name'] . " " . $sd['emp_last_name'] . "</h3>"; echo "<table>"; echo '<tr>'; echo "<td class='label'>Sr.No</td><td>" . $i . "</td>"; foreach ($selected_list as $s) { if ($s == 'emp_department_name') { echo "<tr><td class='label'>Department</td><td>" . EmpDepartment::findOne($sd['emp_master_department_id'])->emp_department_name . "</td></tr>"; } else { if ($s == 'emp_designation_name') { if ($sd['emp_master_designation_id'] != null) { echo "<tr><td class='label'>Designation </td><td class='text-center'>" . EmpDesignation::findOne($sd['emp_master_designation_id'])->emp_designation_name . "</td></tr>"; } else { echo "<tr><td> </td></tr>"; } } else { if ($s == 'emp_cadd') { if ($sd['emp_master_emp_address_id'] != 0) { echo "<tr><td class='label'>Local Address</td>"; if (!empty(EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_cadd_city)) { $add_c = "<br/>" . City::findOne(EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_cadd_city)->city_name . ", "; } else { $add_c = '';
use app\modules\employee\models\EmpDesignation; ?> <div class="grid-view user-data"> <?php if (!empty($employee_data)) { $emp_info = new EmpInfo(); echo "</br></br><h3>" . Yii::t('report', 'Employee List') . "</h3>"; $i = 1; foreach ($employee_data as $t => $sd) { echo "<h3>" . $sd['emp_first_name'] . " " . $sd['emp_last_name'] . "</h3>"; echo "<table>"; echo '<tr>'; echo "<td class='label'>" . Yii::t('report', 'Sr.No') . "</td><td>" . $i . "</td>"; foreach ($selected_list as $s) { if ($s == 'emp_department_name') { echo "<tr><td class='label'>" . Yii::t('report', 'Department') . "</td><td>" . EmpDepartment::findOne($sd['emp_master_department_id'])->emp_department_name . "</td></tr>"; } else { if ($s == 'emp_designation_name') { if ($sd['emp_master_designation_id'] != null) { echo "<tr><td class='label'>" . Yii::t('report', 'Designation') . " </td><td class='text-center'>" . EmpDesignation::findOne($sd['emp_master_designation_id'])->emp_designation_name . "</td></tr>"; } else { echo "<tr><td> </td></tr>"; } } else { if ($s == 'emp_cadd') { if ($sd['emp_master_emp_address_id'] != 0) { echo "<tr><td class='label'>" . Yii::t('report', 'Local Address') . "</td>"; if (!empty(EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_cadd_city)) { $add_c = "<br/>" . City::findOne(EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_cadd_city)->city_name . ", "; } else { $add_c = '';