public function actionStuinforeport() { $selected_list = $query = NULL; $student_data = array(); $model = new StuMaster(); $info = new StuInfo(); $course = $batch = $section = null; if (!empty($_POST['s_info']) && !empty($_POST['StuMaster']['stu_master_course_id']) || (!empty($_POST['StuMaster']['report_batch_id']) || !empty($_POST['StuMaster']['report_section_id']) || !empty($_POST['StuMaster']['report_city']) || !empty($_POST['StuInfo']['stu_gender']))) { if (Yii::$app->request->isAjax) { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; return ActiveForm::validateMultiple([$model, $info]); } if (!empty($_POST['StuMaster']['stu_master_course_id'])) { $query .= "stu.stu_master_course_id=" . $_POST['StuMaster']['stu_master_course_id'] . " AND "; } if (!empty($_POST['StuMaster']['report_batch_id'])) { $query .= "stu.stu_master_batch_id=" . $_POST['StuMaster']['report_batch_id'] . " AND "; } if (!empty($_POST['StuMaster']['report_section_id'])) { $query .= "stu.stu_master_section_id=" . $_POST['StuMaster']['report_section_id'] . " AND "; } if (!empty($_POST['StuMaster']['report_city'])) { $query .= "add.stu_cadd_city=" . $_POST['StuMaster']['report_city'] . " AND "; } if (!empty($_POST['StuInfo']['stu_gender'])) { $query .= "s_info.stu_gender='" . $_POST['StuInfo']['stu_gender'] . "' AND "; } if (!empty($_POST['s_info'])) { $selected_list = $_POST['s_info']; } echo $model->validate(); $query1 = new \yii\db\Query(); $query1->select('*')->from('stu_master stu')->join('join', 'stu_info s_info', 's_info.stu_info_id = stu.stu_master_stu_info_id')->join('join', 'stu_address add', 'add.stu_address_id = stu.stu_master_stu_address_id')->where($query . 'stu.is_status = 0'); $command = $query1->createCommand(); $student_data = $command->queryAll(); if (empty($student_data)) { \Yii::$app->getSession()->setFlash('studerror', "<i class='fa fa-exclamation-triangle'></i> <b> No Record For This Criteria.</b>"); return $this->redirect(['stuinforeport']); } return $this->render('stu_info_report', ['student_data' => $student_data, 'selected_list' => $selected_list, 'query' => $query]); break; } return $this->render('stu_report_view', ['model' => $model, 'info' => $info, 'query' => $query, 'selected_list' => $selected_list]); }
public function actionStuinforeport() { $student_data = $selected_list = []; $model = new StuMaster(); $info = new StuInfo(); if ($model->load(Yii::$app->request->post()) && $info->load(Yii::$app->request->post())) { if (Yii::$app->request->isAjax) { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; return ActiveForm::validateMultiple([$model, $info]); } $selected_list = $_POST['s_info']; $query1 = new \yii\db\Query(); $query1->select('*')->from('stu_master stu')->join('join', 'stu_info s_info', 's_info.stu_info_id = stu.stu_master_stu_info_id')->join('join', 'stu_address add', 'add.stu_address_id = stu.stu_master_stu_address_id')->where(['stu.is_status' => 0])->andFilterWhere(['stu.stu_master_course_id' => $model->stu_master_course_id])->andFilterWhere(['stu.stu_master_batch_id' => $model->report_batch_id])->andFilterWhere(['stu.stu_master_section_id' => $model->report_section_id])->andFilterWhere(['add.stu_cadd_city' => $model->report_city])->andFilterWhere(['s_info.stu_gender' => $info->stu_gender]); $command = $query1->createCommand(); $student_data = $command->queryAll(); Yii::$app->session->set('data["stuData"]', $student_data); Yii::$app->session->set('data["selection"]', $selected_list); if (empty($student_data)) { \Yii::$app->getSession()->setFlash('studerror', "<i class='fa fa-exclamation-triangle'></i> <b> " . Yii::t('report', 'No Record Found For This Criteria.') . "</b>"); return $this->redirect(['stuinforeport']); } return $this->render('stu_info_report', ['student_data' => $student_data, 'selected_list' => $selected_list]); } else { if (Yii::$app->request->get('exportExcel')) { $file = $this->renderPartial('stu_info_report_excel', array('student_data' => Yii::$app->session->get('data["stuData"]'), 'selected_list' => Yii::$app->session->get('data["selection"]'))); $fileName = "Employee_info_report" . date('YmdHis') . '.xls'; $options = ['mimeType' => 'application/vnd.ms-excel']; return Yii::$app->excel->exportExcel($file, $fileName, $options); } else { if (Yii::$app->request->get('exportPDF')) { $html = $this->renderPartial('stu_info_report_pdf', array('student_data' => Yii::$app->session->get('data["stuData"]'), 'selected_list' => Yii::$app->session->get('data["selection"]'))); ob_clean(); return Yii::$app->pdf->exportData('Employee Info Report', 'Employee_info_report', $html); } } } return $this->render('stu_report_view', ['model' => $model, 'info' => $info, 'selected_list' => $selected_list]); }
public function actionStudentProfilePdf($sid) { $nationality = $stuAdd = []; $stuMaster = StuMaster::findOne($sid); $stuDocs = StuDocs::find()->where(['stu_docs_stu_master_id' => $sid])->join('join', 'document_category dc', 'dc.doc_category_id = stu_docs_category_id AND dc.is_status <> 2')->all(); $stuInfo = StuInfo::find()->where(['stu_info_stu_master_id' => $sid])->one(); $stuCourse = Courses::findOne($stuMaster->stu_master_course_id); $stuBatch = Batches::findOne($stuMaster->stu_master_batch_id); $stuSection = Section::findOne($stuMaster->stu_master_section_id); $stuGuard = StuGuardians::findAll(['guardia_stu_master_id' => $sid]); $sDocs = new StuDocs(); if ($stuMaster->stu_master_nationality_id !== null) { $nationality = Nationality::findOne($stuMaster->stu_master_nationality_id)->nationality_name; } if ($stuMaster->stu_master_stu_address_id !== null) { $stuAdd = StuAddress::findOne($stuMaster->stu_master_stu_address_id); } $html = $this->renderPartial('/stu-master/stuprofilepdf', ['stuDocs' => $stuDocs, 'stuMaster' => $stuMaster, 'stuInfo' => $stuInfo, 'nationality' => $nationality, 'stuBatch' => $stuBatch, 'stuCourse' => $stuCourse, 'stuSection' => $stuSection, 'stuAdd' => $stuAdd, 'stuGuard' => $stuGuard, 'sDocs' => $sDocs]); $fName = $stuInfo->stu_first_name . "_" . $stuInfo->stu_last_name . "_" . date('Ymd-His'); return Yii::$app->pdf->exportData(Yii::t('report', 'Student Report'), $fName, $html); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = StuMaster::find()->where(['is_status' => 0]); $query->joinWith(['stuMasterStuInfo', 'stuMasterUser']); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['stu_master_id' => SORT_DESC]]]); $dataProvider->sort->attributes['stu_first_name'] = ['asc' => ['stu_info.stu_first_name' => SORT_ASC], 'desc' => ['stu_info.stu_first_name' => SORT_DESC]]; $dataProvider->sort->attributes['stu_last_name'] = ['asc' => ['stu_info.stu_last_name' => SORT_ASC], 'desc' => ['stu_info.stu_last_name' => SORT_DESC]]; $dataProvider->sort->attributes['stu_unique_id'] = ['asc' => ['stu_info.stu_unique_id' => SORT_ASC], 'desc' => ['stu_info.stu_unique_id' => SORT_DESC]]; $dataProvider->sort->attributes['user_login_id'] = ['asc' => ['users.user_login_id' => SORT_ASC], 'desc' => ['users.user_login_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(['stu_master_id' => $this->stu_master_id, 'stu_master_stu_info_id' => $this->stu_master_stu_info_id, 'stu_master_user_id' => $this->stu_master_user_id, 'stu_master_nationality_id' => $this->stu_master_nationality_id, 'stu_master_category_id' => $this->stu_master_category_id, 'stu_master_course_id' => $this->stu_master_course_id, 'stu_master_batch_id' => $this->stu_master_batch_id, 'stu_master_section_id' => $this->stu_master_section_id, 'stu_master_stu_status_id' => $this->stu_master_stu_status_id, 'stu_master_stu_address_id' => $this->stu_master_stu_address_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', 'stu_info.stu_first_name', $this->stu_first_name])->andFilterWhere(['like', 'stu_info.stu_unique_id', $this->stu_unique_id])->andFilterWhere(['like', 'users.user_login_id', $this->user_login_id])->andFilterWhere(['like', 'stu_info.stu_last_name', $this->stu_last_name]); unset($_SESSION['exportData']); $_SESSION['exportData'] = $dataProvider; return $dataProvider; }
public function actionIndex() { $paidData = $unPaidData = $fcCategory = []; if (Yii::$app->session->get('stu_id')) { return $this->redirect(['/fees/fees-payment-transaction/stu-fees-data']); } //Course Wise Collection Count $cateWisePaid = 0; $courseWiseCollect = (new \yii\db\Query())->select(["(cs.course_name) AS '0'", 'SUM(fpt.fees_pay_tran_amount) AS "1"'])->from('fees_payment_transaction fpt')->join('JOIN', 'courses cs', 'cs.course_id = fpt.fees_pay_tran_course_id')->where(['cs.is_status' => 0, 'fpt.is_status' => 0])->groupBy('fpt.fees_pay_tran_course_id')->all(); $actFcc = \app\modules\fees\models\FeesCollectCategory::find()->where(['is_status' => 0])->asArray()->all(); foreach ($actFcc as $v) { $stuCount = \app\modules\student\models\StuMaster::find()->where(['is_status' => 0, 'stu_master_batch_id' => $v['fees_collect_batch_id']])->count(); $fccTotal = \app\modules\fees\models\FeesCategoryDetails::getFeeCategoryTotal($v['fees_collect_category_id']); $cateWisePaid += $stuCount * $fccTotal; } $paidTotal = (new \yii\db\Query())->from('fees_payment_transaction fpt')->join('JOIN', 'fees_collect_category fcc', 'fpt.fees_pay_tran_collect_id = fees_collect_category_id')->where(['fcc.is_status' => 0, 'fpt.is_status' => 0])->sum('fpt.fees_pay_tran_amount'); $paidPer = ' (' . ($cateWisePaid != 0 ? round($paidTotal * 100 / $cateWisePaid, 2) : 0) . '%)'; $unPaidPer = ' (' . ($cateWisePaid != 0 ? round(($cateWisePaid - $paidTotal) * 100 / $cateWisePaid, 2) : 0) . '%)'; $paidUnpaidData = [['name' => 'Paid' . $paidPer, 'y' => $paidTotal, 'color' => '#77C730'], ['name' => 'Unpaid' . $unPaidPer, 'y' => $cateWisePaid - $paidTotal, 'color' => '#F45B5B']]; //Individual Fees Collection Category Wise $fcWiseDetails = (new \yii\db\Query())->select(['fees_collect_category_id', 'fees_collect_batch_id', "CONCAT(fcc.fees_collect_name,'(',bt.batch_name,')') AS fc_name"])->from('fees_collect_category fcc')->join('JOIN', 'batches bt', 'bt.batch_id = fcc.fees_collect_batch_id')->where(['fcc.is_status' => '0'])->orderBy('fcc.fees_collect_category_id DESC')->limit('10')->all(); $fccTotal = $fccPaid = 0; foreach ($fcWiseDetails as $k => $v) { $stuCount = \app\modules\student\models\StuMaster::find()->where(['is_status' => 0, 'stu_master_batch_id' => $v['fees_collect_batch_id']])->count(); $fccTotalTmp = \app\modules\fees\models\FeesCategoryDetails::getFeeCategoryTotal($v['fees_collect_category_id']); $fccPaidTmp = (new \yii\db\Query())->from('fees_payment_transaction fpt')->where(['fpt.is_status' => 0, 'fpt.fees_pay_tran_collect_id' => $v['fees_collect_category_id']])->sum('fpt.fees_pay_tran_amount'); $fccTotal = $stuCount * $fccTotalTmp; $fccPaid = $fccPaidTmp === NULL ? 0 : $fccPaidTmp; $fccUnPaid = $fccTotal - $fccPaid; $fcCategory[] = $v['fc_name']; $paidData[] = $fccPaid; $unPaidData[] = $fccUnPaid; } $fccWisePaidUnPaid = [['name' => 'Paid Amount', 'data' => $paidData, 'color' => '#77C730'], ['name' => 'Unpaid Amount', 'data' => $unPaidData, 'color' => '#F45B5B']]; //Recently fees transaction $feeRecent = (new \yii\db\Query())->select(['fpt.fees_pay_tran_id', 'fpt.fees_pay_tran_amount', 'stu_unique_id', "CONCAT(si.stu_first_name, ' ', si.stu_last_name) AS 'stu_name'", 'fcc.fees_collect_name', 'DATE_FORMAT(fpt.fees_pay_tran_date, "%d-%m-%Y") AS tranDate'])->from('fees_payment_transaction fpt')->join('JOIN', 'fees_collect_category fcc', 'fcc.fees_collect_category_id = fpt.fees_pay_tran_collect_id')->join('JOIN', 'stu_info si', 'si.stu_info_stu_master_id = fpt.fees_pay_tran_stu_id')->where(['fpt.is_status' => '0'])->orderBy('fees_pay_tran_id DESC')->limit(10)->all(); return $this->render('index', ['feeRecent' => $feeRecent, 'courseWiseCollect' => $courseWiseCollect, 'paidUnpaidData' => $paidUnpaidData, 'fccWisePaidUnPaid' => $fccWisePaidUnPaid, 'fcCategory' => $fcCategory]); }
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]); }
<?php echo Html::a('<i class="fa fa-pencil-square-o"></i>', ['section/update', 'id' => $sv['section_id']], ['class' => 'btn-xs btn btn-default', 'title' => Yii::t('course', 'Edit Section Details')]); ?> <?php echo Html::a('<i class="fa fa-trash-o"></i>', ['section/delete', 'id' => $sv['section_id']], ['class' => 'btn-xs btn btn-default', 'title' => Yii::t('course', 'Delete'), 'data' => ['confirm' => Yii::t('course', 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> <div class="pull-right hidden-xs"> <span class="label label-default"> <i class="fa fa-users"></i> <?php echo Yii::t('course', 'Students'); ?> <span class="badge" style="background:#fff;color: #777;"> <?php echo StuMaster::find()->where(['is_status' => 0, 'stu_master_section_id' => $sv['section_id']])->count(); ?> </span> </span> <?php if ($bv['is_status'] == 0) { ?> <span class="label label-success"><?php echo Yii::t('course', 'Active'); ?> </span> <?php } else { ?> <span class="label label-danger"><?php echo Yii::t('course', 'Inactive');
public function getRelStuData() { return $this->hasOne(\app\modules\student\models\StuMaster::className(), ['stu_master_id' => 'fees_pay_tran_stu_id']); }
public function importStuData($model) { $dispResults = []; $totalSuccess = 0; $objPHPExcel = PHPExcel_IOFactory::load($model->importFilePath . $model->importFile); $sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true); //print_r($sheetData); exit; unset($sheetData[1]); //start import student row by row foreach ($sheetData as $k => $line) { //print_r($line); exit; if (!array_filter($line)) { continue; } $line = array_map('trim', $line); $line = array_map(function ($value) { return empty($value) ? NULL : $value; }, $line); $stuMaster = new StuMaster(); $stuInfo = new StuInfo(); $stuInfo->scenario = 'import-stu'; $stuAddress = new StuAddress(); $user = new User(); $auth_assign = new AuthAssignment(); //set student info attributes $stuInfo->stu_unique_id = $stuInfo->getUniqueId(); // Student Unique Id $stuInfo->stu_title = $this->valueReplace($line['A'], $stuInfo->getTitleOptions()); //Title Name $stuInfo->stu_first_name = $line['B']; //First Name $stuInfo->stu_last_name = $line['C']; //Last Name $stuInfo->stu_dob = Yii::$app->dateformatter->getDateFormat($line['D']); //Date of Birth $stuInfo->stu_admission_date = Yii::$app->dateformatter->getDateFormat($line['H']); //Student Admission Date $stuInfo->stu_gender = $this->valueReplace($line['I'], $stuInfo->getGenderOptions()); // Gender $stuInfo->stu_email_id = $line['J']; // Email ID $stuInfo->stu_mobile_no = $line['K']; // Mobile No //set student master attribute $stuMaster->stu_master_course_id = $this->valueReplace($line['E'], Courses::getStuCourse()); // Course $stuMaster->stu_master_batch_id = $this->valueReplace($line['F'], Batches::getStuBatches()); // Batch $stuMaster->stu_master_section_id = $this->valueReplace($line['G'], Section::getStuSection()); // Section $stuMaster->stu_master_category_id = $this->valueReplace($line['L'], StuCategory::getStuCategoryId()); //Admission Category $stuMaster->stu_master_nationality_id = $this->valueReplace($line['M'], Nationality::getNationality()); //Nationality //set student address attribute $stuAddress->stu_cadd = $line['N']; //Current Address $stuAddress->stu_cadd_city = $this->valueReplace($line['O'], City::getAllCity()); //City $stuAddress->stu_cadd_state = $this->valueReplace($line['P'], State::getAllState()); //State $stuAddress->stu_cadd_country = $this->valueReplace($line['Q'], Country::getAllCountry()); //Country $stuAddress->stu_cadd_pincode = $line['R']; //Pincode $stuAddress->stu_cadd_house_no = $line['S']; //House No $stuAddress->stu_cadd_phone_no = $line['T']; //Phone No //set user login info attributes $uniq_id = $stuInfo->getUniqueId(); $login_id = \app\models\Organization::find()->one()->org_stu_prefix . $uniq_id; $user->user_login_id = $login_id; //user login id $user->user_password = md5($user->user_login_id . $user->user_login_id); //user password $user->user_type = "S"; //user type $user->created_by = Yii::$app->getid->getId(); //created by $user->created_at = new \yii\db\Expression('NOW()'); //created at if ($user->validate() && $stuInfo->validate() && $stuAddress->validate()) { $transaction = Yii::$app->db->beginTransaction(); try { if ($stuInfo->save() && $user->save() && $stuAddress->save()) { $stuMaster->stu_master_stu_info_id = $stuInfo->stu_info_id; $stuMaster->stu_master_user_id = $user->user_id; $stuMaster->stu_master_stu_address_id = $stuAddress->stu_address_id; $stuMaster->created_by = Yii::$app->getid->getId(); $stuMaster->created_at = new \yii\db\Expression('NOW()'); if ($stuMaster->save()) { $stuInfo->stu_info_stu_master_id = $stuMaster->stu_master_id; if ($stuInfo->save(false)) { $auth_assign->item_name = 'Student'; $auth_assign->user_id = $user->user_id; $auth_assign->created_at = date_format(date_create(), 'U'); $auth_assign->save(false); $transaction->commit(); $totalSuccess += 1; $dispResults[] = array_merge($line, ['type' => 'S', 'stuMasterId' => $stuMaster->stu_master_id, 'message' => 'Success']); } } else { $dispResults[] = array_merge($line, ['type' => 'E', 'message' => Html::errorSummary($stuMaster)]); } } // end stuInfo, user, StuAddress $transaction->rollback(); } catch (\Exception $e) { $transaction->rollBack(); $dispResults[] = array_merge($line, ['type' => 'E', 'message' => $e->getMessage()]); } } else { $dispResults[] = array_merge($line, ['type' => 'E', 'message' => Html::errorSummary([$user, $stuInfo, $stuMaster, $stuAddress])]); } //end validated if } //end foreach return ['dispResults' => $dispResults, 'totalSuccess' => $totalSuccess]; }
/** * Finds the StuMaster model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return StuMaster the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = StuMaster::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<div class="icon"> <i class="fa fa-toggle-on" style="font-size: 60px;"></i> </div> <?php echo Html::a('More Info <i class="fa fa-arrow-circle-right"></i>', ['/report/student/stuinforeport'], ['class' => 'small-box-footer']); ?> </div> </div> <!---Start Count Deactive Student---> <div class="col-lg-3 col-xs-6"> <!-- small box --> <div class="small-box bg-red"> <div class="inner"> <h3><?php echo \app\modules\student\models\StuMaster::find()->where(['is_status' => 1])->count(); ?> </h3> <p>Deactive Students</p> </div> <div class="icon"> <i class="fa fa-toggle-off" style="font-size: 60px;"></i> </div> <?php echo Html::a('More Info <i class="fa fa-arrow-circle-right"></i>', ['/report/student/stuinforeport'], ['class' => 'small-box-footer']); ?> </div> </div> <!---Start Count Active Employee---> <div class="col-lg-3 col-xs-6">
/** * @return \yii\db\ActiveQuery */ public function getStuMasters() { return $this->hasMany(StuMaster::className(), ['stu_master_category_id' => 'stu_category_id']); }
/** * Display Individual Student Fees Data. * If student is login, the fees data display based on student login id other wise request id. * @param integer $sid * @return mixed */ public function actionStuFeesData() { if (Yii::$app->session->get('stu_id')) { $sid = Yii::$app->session->get('stu_id'); } else { if (!empty($_REQUEST['sid'])) { $sid = $_REQUEST['sid']; } else { throw new \yii\web\BadRequestHttpException("Missing required parameters: sid"); } } $model = new FeesPaymentTransaction(); $stuData = \app\modules\student\models\StuMaster::findOne($sid); $FccModel = new \app\modules\fees\models\FeesCollectCategory(); return $this->render('stu-fees-data', ['model' => $model, 'stuData' => $stuData, 'FccModel' => $FccModel]); }
public function actionUpdatestudloginid($id) { $model = $this->findModel($id); $student_data = StuMaster::find()->where(['stu_master_user_id' => $_REQUEST['id']])->one(); $student_info = StuInfo::findOne($student_data->stu_master_stu_info_id)->stu_first_name; if (isset($_POST['User'])) { $model->attributes = $_POST['User']; $model->user_login_id = $_POST['User']['user_login_id']; \Yii::$app->session->setFlash('resetstudloginid', "<i class='glyphicon glyphicon-info-sign'></i> " . $student_info . "'s Login id is Reset"); if ($model->save()) { \Yii::$app->session->setFlash('resetstudloginid', "<i class='glyphicon glyphicon-info-sign'></i> " . $student_info . "'s Login id is Reset"); return $this->redirect(['resetstudloginid']); } } return $this->render('updatestudloginid', ['model' => $model]); }
public function getStuMaster() { return $this->hasOne(StuMaster::className(), ['stu_master_user_id' => 'user_id']); }
?> <div class="grid-view"> <?php if (!empty($stuData)) { echo '<table class="table table-striped">'; echo '<tr>'; echo '<th class="text-center">' . Yii::t('fees', 'SI No.') . '</th>'; echo '<th>' . Yii::t('fees', 'Student No') . '</th>'; echo '<th>' . Yii::t('fees', 'Student Name') . '</th>'; echo '<th>' . Yii::t('fees', 'Total Collection') . '</th>'; echo '<th>' . Yii::t('fees', 'Paid Amount') . '</th>'; echo '<th>' . Yii::t('fees', 'Unpaid Amount') . '</th>'; echo '</tr>'; $sr = 1; foreach ($stuData as $key => $value) { $stuDetails = \app\modules\student\models\StuMaster::findOne($value); echo '<tr>'; echo '<td class="text-center">' . $sr++ . '</td>'; echo '<td>' . (!empty($stuDetails->stuMasterStuInfo->stu_unique_id) ? $stuDetails->stuMasterStuInfo->stu_unique_id : "(Not Set)") . '</td>'; echo '<td>' . $stuDetails->stuMasterStuInfo->name . '</td>'; echo '<td>' . $totalAmount . '</td>'; $payFees = $FptModel->getStuTotalPayFees($value, $FccModel->fees_collect_category_id); echo '<td>' . (!empty($payFees) ? $payFees : "0") . '</td>'; echo '<td>' . ($actualCollect = $totalAmount - $payFees . '</td>'); echo '</tr>'; $gTotalAmount += $totalAmount; $gpayFees += $payFees; $gActualCollect += $actualCollect; } echo '<tr class="bg-aqua"><th colspan="3" class="text-right">' . Yii::t('fees', 'GRAND TOTAL') . ' </th>'; echo '<th>' . $gTotalAmount . '</th>';
/** * @return \yii\db\ActiveQuery */ public function getGuardiaStuMaster() { return $this->hasOne(StuMaster::className(), ['stu_master_id' => 'guardia_stu_master_id']); }
public function actionLogin() { $this->checkInstallation(); if (!\Yii::$app->user->isGuest) { return $this->goHome(); } $model = new LoginForm(); $login = new \app\models\LoginDetails(); if ($model->load(Yii::$app->request->post())) { $log = \app\models\User::find()->where(['user_login_id' => $_POST['LoginForm']['username'], 'is_block' => 0])->one(); if (empty($log)) { \Yii::$app->session->setFlash('loginError', '<i class="fa fa-warning"></i><b> Incorrect username or password. !</b>'); return $this->render('login', ['model' => $model]); } $login->login_user_id = $log['user_id']; $loginuser = $login->login_user_id; $emplogin = EmpMaster::find()->andWhere(['emp_master_user_id' => $loginuser])->one(); $studlogin = StuMaster::find()->andWhere(['stu_master_user_id' => $loginuser])->one(); if ($studlogin) { \Yii::$app->session->set('stu_id', $studlogin->stu_master_id); } else { if ($emplogin) { \Yii::$app->session->set('emp_id', $emplogin->emp_master_id); } else { if (!$emplogin && !$studlogin) { \Yii::$app->session->set('admin_user', $loginuser); } else { \Yii::$app->session->setFlash('loginError', '<i class="fa fa-warning"></i><b> These Login credentials are Blocked/Deactive by Admin</b>'); return $this->render('login', ['model' => $model]); } } } $login->login_status = 1; $login->login_at = new \yii\db\Expression('NOW()'); $login->user_ip_address = $_SERVER['REMOTE_ADDR']; $login->save(false); if ($model->login()) { if (!isset(Yii::$app->request->cookies['language'])) { return $this->redirect(['language']); } else { return $this->goBack(); } } else { return $this->render('login', ['model' => $model]); } } else { return $this->render('login', ['model' => $model]); } }
/** * @return \yii\db\ActiveQuery */ public function getStuMasters() { return $this->hasOne(StuMaster::className(), ['stu_master_stu_address_id' => 'stu_address_id']); }