public function run($model) { $pdf = new ExportToPdf(); $data = $model::getExportData(); $html = $this->controller->renderPartial($data['pdfFile'], array('model' => $data['data']), true); $pdf->exportData($data['filename'], $model . '.pdf', $html); }
public function actionCourseWiseFeesReport() //done by hirenb { $model=new FeesPaymentTransaction; $model->scenario = 'courseWiseFeesReport'; $this->performAjaxValidation($model); $status=false; $student_data = array(); $query = NULL; if(!empty($_REQUEST['FeesPaymentTransaction']['fees_payment_batch_id']) || !empty($_REQUEST['FeesPaymentTransaction']['fees_student_course_id'])) { $status=true; if(!empty($_REQUEST['FeesPaymentTransaction']['fees_payment_batch_id'])) { $query.="st.student_transaction_batch_id=".$_REQUEST['FeesPaymentTransaction']['fees_payment_batch_id']." AND "; } /* if(!empty($_REQUEST['FeesPaymentTransaction']['fees_student_academic_term_id'])) { $query.="st.academic_term_id = ".$_REQUEST['FeesPaymentTransaction']['fees_student_academic_term_id']." AND "; } */ $query_final = $query."st.course_id = ". $_REQUEST['FeesPaymentTransaction']['fees_student_course_id'].""; $student_data = Yii::app()->db->createCommand() ->select('st.*, si.student_roll_no, si.student_first_name, si.student_last_name,si.student_middle_name') ->from('student_transaction st') ->join('student_info si','si.student_info_transaction_id = st.student_transaction_id') ->where($query_final.' order by si.student_roll_no') ->queryAll(); } //start export PDF and Excel by hiren if(!empty($_REQUEST['exp_batch_id']) || !empty($_REQUEST['exp_course_id'])) { if(!empty($_REQUEST['exp_batch_id'])) { $query.="st.student_transaction_batch_id=".$_REQUEST['exp_batch_id']." AND "; } if(!empty($_REQUEST['exp_sem_id'])) { $query.="st.academic_term_id = ".$_REQUEST['exp_sem_id']." AND "; } $query_final = $query." st.course_id = ".$_REQUEST['exp_course_id'].""; $exp_stu_data = Yii::app()->db->createCommand() ->select('st.*, si.student_roll_no, si.student_first_name, si.student_last_name,si.student_middle_name') ->from('student_transaction st') ->join('student_info si','si.student_info_transaction_id = st.student_transaction_id') ->where($query_final.' order by si.student_roll_no') ->queryAll(); } if(isset($_REQUEST['PDF'])) { $pdf = new ExportToPdf; $filename="StudentFeesReport_".date('YmdHis').".pdf"; $html = $this->renderPartial('course_wise_fees_report_pdf', array('exp_stu_data'=>$exp_stu_data), true); $pdf->exportData('Couser Wise Student Fees Report',$filename,$html); } if(isset($_REQUEST['excel'])) { Yii::app()->request->sendFile(date('YmdHis').'.xls', $this->renderPartial('course_wise_fees_report_excel', array('exp_stu_data'=>$exp_stu_data), true) ); } $this->render('course_wise_fees_report',array( 'model'=>$model,'status'=>$status,'student_data'=>$student_data )); }
public function actionStudentFinalViewExportToPdf($id) { $student_docs = StudentDocsTrans::model()->findAll('student_docs_trans_user_id='.$id); $studentqualification = StudentAcademicRecordTrans::model()->findAll('student_academic_record_trans_stud_id='.$id); $student_transaction = StudentTransaction::model()->findAll('student_transaction_id='.$id); //$studentfeedbackdetailstable = FeedbackDetailsTable::model()->findAll('feedback_details_table_student_id='.$id); $html = $this->renderPartial('/studentTransaction/studentfinalview', array( 'student_docs'=>$student_docs, 'studentqualification'=>$studentqualification, 'student_transaction'=>$student_transaction, //'studentfeedbackdetailstable'=>$studentfeedbackdetailstable, ), true); $mpdf = new ExportToPdf(); $mpdf->exportData('Stundent Report','StundentFinalView.pdf',$html); }
public function actionSelectedEmployeeList() { $query = $_SESSION['query']; if (!empty($_REQUEST['employeelistexport'])) { $query = $_SESSION['query']; $selected_list = $_SESSION['selected_list']; $employee_data = Yii::app()->db->createCommand()->select('*')->from('employee_transaction emp')->join('employee_info emp_info', 'emp_info.employee_id = emp.employee_transaction_employee_id')->leftJoin('employee_address add', 'add.employee_address_id = emp.employee_transaction_emp_address_id')->where($query . ' employee_status=0')->queryAll(); Yii::import('application.extensions.tcpdf.*'); require_once 'tcpdf/tcpdf.php'; require_once 'tcpdf/config/lang/eng.php'; $html = $this->renderPartial('emp_report_view_pdf', array('emp_data' => $employee_data, 'selected_emp_list' => $selected_list), true); $pdf = new ExportToPdf(); $pdf->exportData('Employee Info Report', 'Employee_info_report.pdf', $html); } else { if (!empty($_REQUEST['employeelistexcelexport'])) { $query = $_SESSION['query']; $selected_list = $_SESSION['selected_list']; $employee_data = Yii::app()->db->createCommand()->select('*')->from('employee_transaction emp')->join('employee_info emp_info', 'emp_info.employee_id = emp.employee_transaction_employee_id')->leftJoin('employee_address add', 'add.employee_address_id = emp.employee_transaction_emp_address_id')->where($query . ' employee_status=0')->queryAll(); Yii::app()->request->sendFile(date('YmdHis') . '.xls', $this->renderPartial('emp_report_view_excel', array('emp_data' => $employee_data, 'selected_emp_list' => $selected_list), true)); } else { $query = $_POST['query']; $selected_list = null; } } $baseUrl = Yii::app()->baseUrl; $cs = Yii::app()->getClientScript(); $cs->registerCssFile($baseUrl . '/css/report.css'); }