public function actionEmployeeProfilePdf($eid) { $nationality = $empAdd = []; $empMaster = EmpMaster::findOne($eid); $empDocs = EmpDocs::find()->where(['emp_docs_emp_master_id' => $eid])->join('join', 'document_category dc', 'dc.doc_category_id = emp_docs_category_id AND dc.is_status <> 2')->all(); $empInfo = EmpInfo::find()->where(['emp_info_emp_master_id' => $eid])->one(); if ($empMaster->emp_master_nationality_id !== null) { $nationality = Nationality::findOne($empMaster->emp_master_nationality_id)->nationality_name; } if ($empMaster->emp_master_emp_address_id !== null) { $empAdd = EmpAddress::findOne($empMaster->emp_master_emp_address_id); } $html = $this->renderPartial('/emp-master/empprofilepdf', ['empDocs' => $empDocs, 'empMaster' => $empMaster, 'empInfo' => $empInfo, 'nationality' => $nationality, 'empAdd' => $empAdd]); $fName = $empInfo->emp_first_name . "_" . $empInfo->emp_last_name . "_" . date('Ymd_His'); return Yii::$app->pdf->exportData(Yii::t('emp', 'Employee Profile'), $fName, $html); }
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); }
/** * Finds the Nationality model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Nationality the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Nationality::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }