public function actionGeneratePdf() 
	{
           $session=new CHttpSession;
           $session->open();
		Yii::import('application.extensions.tcpdf.*');
		require_once('tcpdf/tcpdf.php');
		require_once('tcpdf/config/lang/eng.php');	
             if(isset($session['ParentLogin_records']))
               {
                $d=$_SESSION['ParentLogin_records'];
		 $model = array();

		if($d->data)
			$model[]=array_keys($d->data[0]->attributes);//headers: cols name
			else
			{
				$this->render('no_data_found',array('last_page'=>$_SERVER['HTTP_REFERER'],));
				exit;			
			}

		foreach ($d->data as $item) {
		    $model[] = $item->attributes;
		}
		//print_r($model);exit;
               }
              


		$html = $this->renderPartial('exportGridtoReport', array(
			'model'=>$model
		), true);
		
		//die($html);
		ob_clean();
		$pdf = new TCPDF();
		$pdf->SetCreator(PDF_CREATOR);
		$pdf->SetAuthor(Yii::app()->name);
		$pdf->SetTitle('ParentLogin Report');
		$pdf->SetSubject('ParentLogin Report');
		//$pdf->SetKeywords('example, text, report');
		$pdf->SetHeaderData('', 0, "Report", '');
		$pdf->setHeaderFont(Array('helvetica', '', 8));
		$pdf->setFooterFont(Array('helvetica', '', 6));
		$pdf->SetMargins(15, 18, 15);
		$pdf->SetHeaderMargin(5);
		$pdf->SetFooterMargin(10);
		$pdf->SetAutoPageBreak(TRUE, 0);
		$pdf->SetFont('dejavusans', '', 7);
		$pdf->AddPage();
		$pdf->writeHTML($html, true, false, true, false, '');
		$pdf->LastPage();
		$pdf->Output("ParentLogin.pdf", "I");
	}
        public function actionGeneratePdf() 
	{
           $session=new CHttpSession;
           $session->open();
		Yii::import('application.extensions.bootstrap.gii.*');
		require_once('bootstrap/tcpdf/tcpdf.php');
		require_once('bootstrap/tcpdf/config/lang/eng.php');

             if(isset($session['Reportepedidosxpdvdetalle_records']))
               {
                $model=$session['Reportepedidosxpdvdetalle_records'];
               }
               else
                 $model = Reportepedidosxpdvdetalle::model()->findAll();



		$html = $this->renderPartial('expenseGridtoReport', array(
			'model'=>$model
		), true);
		
		//die($html);
		
		$pdf = new TCPDF();
		$pdf->SetCreator(PDF_CREATOR);
		$pdf->SetAuthor(Yii::app()->name);
		$pdf->SetTitle('Reportepedidosxpdvdetalle Report');
		$pdf->SetSubject('Reportepedidosxpdvdetalle Report');
		//$pdf->SetKeywords('example, text, report');
		$pdf->SetHeaderData('', 0, "Report", '');
		$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Example Report by ".Yii::app()->name, "");
		$pdf->setHeaderFont(Array('helvetica', '', 8));
		$pdf->setFooterFont(Array('helvetica', '', 6));
		$pdf->SetMargins(15, 18, 15);
		$pdf->SetHeaderMargin(5);
		$pdf->SetFooterMargin(10);
		$pdf->SetAutoPageBreak(TRUE, 0);
		$pdf->SetFont('dejavusans', '', 7);
		$pdf->AddPage();
		$pdf->writeHTML($html, true, false, true, false, '');
		$pdf->LastPage();
		$pdf->Output("Reportepedidosxpdvdetalle_002.pdf", "I");
	}
 public function actionStudentwisereportpdf()
 {
     if (!empty($_REQUEST['student_enroll_no']) && !empty($_REQUEST['start']) && !empty($_REQUEST['end'])) {
         //$start=null;
         //$end=null;
         $en = trim($_REQUEST['student_enroll_no']);
         $student_data = StudentInfo::model()->findByAttributes(array('student_enroll_no' => $en));
         $stud_trans = StudentTransaction::model()->findByAttributes(array('student_transaction_student_id' => $student_data['student_id']));
         $new_start = $_REQUEST['start'];
         $new_end = $_REQUEST['end'];
         $start = date("Y-m-d", strtotime($new_start));
         $end = date("Y-m-d", strtotime($new_end));
         $att_info = Attendence::model()->findAll(array('select' => 'sem_name_id', 'distinct' => true, 'condition' => 'attendence_date >=:date_start and attendence_date <= :date_end and st_id = :stu_id', 'params' => array(':date_start' => $start, ':date_end' => $end, 'stu_id' => $stud_trans['student_transaction_id'])));
         $sem_data = array();
         //print_r($att_info['sem_name_id']); exit;
         foreach ($att_info as $list) {
             $sem_data[] = $list['sem_name_id'];
         }
         $sem_array = implode(',', $sem_data);
         $subject_data = Yii::app()->db->createCommand()->select('*')->from('subject_master')->where('subject_master_id in (select sub_id from attendence where branch_id=' . $stud_trans['student_transaction_branch_id'] . ' and sem_id=' . $stud_trans['student_academic_term_period_tran_id'] . ') and subject_master_academic_terms_name_id IN(' . $sem_array . ')  AND subject_master_organization_id=' . Yii::app()->user->getState('org_id'))->queryAll();
         //$subject_data = SubjectMaster::model()->findAll(array('condition'=>'subject_master_academic_terms_period_id='.$stud_trans['student_academic_term_period_tran_id'].' AND subject_master_academic_terms_name_id IN('.$sem_array.') AND subject_master_branch_id ='.$stud_trans['student_transaction_branch_id'].' AND subject_master_organization_id='.Yii::app()->user->getState('org_id')));
         /*$new_start=$_REQUEST['start'];
         		$new_end=$_REQUEST['end'];
         			
         		$start = date("Y-m-d", strtotime($new_start));
         		$end = date("Y-m-d", strtotime($new_end));*/
         if (isset($_REQUEST['studenewisereportpdf'])) {
             Yii::import('application.extensions.tcpdf.*');
             require_once 'tcpdf/tcpdf.php';
             require_once 'tcpdf/config/lang/eng.php';
             //$this->actiondate_report();
             $html = $this->renderPartial('student_report_view_pdf', array('subject_data' => $subject_data, 'student_data' => $student_data, 'start' => $_REQUEST['start'], 'end' => $_REQUEST['end']), true);
             //print_r($html);exit;
             ob_clean();
             $pdf = new TCPDF();
             $pdf->SetCreator(PDF_CREATOR);
             $pdf->SetAuthor(Yii::app()->name);
             $pdf->SetTitle('StudentWise Report');
             $pdf->SetSubject('StudentWise Report');
             $pdf->SetKeywords('example, text, report');
             $pdf->SetHeaderData('', 0, "Report", '');
             //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Example Report by ".Yii::app()->name, "");
             $pdf->setHeaderFont(array('helvetica', '', 8));
             $pdf->setFooterFont(array('helvetica', '', 6));
             $pdf->SetMargins(15, 18, 15);
             $pdf->SetHeaderMargin(5);
             $pdf->SetFooterMargin(10);
             $pdf->SetAutoPageBreak(TRUE, 15);
             $pdf->SetFont('dejavusans', '', 7);
             $resolution = array(150, 150);
             $pdf->AddPage('P', $resolution);
             $pdf->writeHTML($html, true, false, true, false, '');
             $pdf->LastPage();
             $pdf->Output("StudentWise.pdf", "I");
         }
         if (isset($_REQUEST['studenewisereportexcel'])) {
             Yii::app()->request->sendFile(date('YmdHis') . '.xls', $this->renderPartial('student_report_view_pdf', array('subject_data' => $subject_data, 'student_data' => $student_data, 'start' => $_REQUEST['start'], 'end' => $_REQUEST['end']), true));
         }
     }
 }
 public function actionAcademicTermPeriodGeneratePdf()
 {
     $session = new CHttpSession();
     $session->open();
     Yii::import('application.extensions.tcpdf.*');
     require_once 'tcpdf/tcpdf.php';
     require_once 'tcpdf/config/lang/eng.php';
     if (isset($session['academic_term_period_records'])) {
         //$model=$session['City_records'];
         $d = $_SESSION['academic_term_period_records'];
         $model = array();
         $model[] = array_keys($d->data[0]->attributes);
         //headers: cols name
         foreach ($d->data as $item) {
             $model[] = $item->attributes;
         }
     }
     $html = $this->renderPartial('/academicTermPeriod/academicTermPeriodGeneratePdf', array('model' => $model), true);
     //$session->close();
     //die($html);
     ob_clean();
     $pdf = new TCPDF();
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor(Yii::app()->name);
     $pdf->SetTitle('Report');
     $pdf->SetSubject('Report');
     $pdf->SetKeywords('example, text, report');
     $pdf->SetHeaderData('', 0, "Report", '');
     //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Example Report by ".Yii::app()->name, "");
     $pdf->setHeaderFont(array('helvetica', '', 8));
     $pdf->setFooterFont(array('helvetica', '', 6));
     $pdf->SetMargins(15, 18, 15);
     $pdf->SetHeaderMargin(5);
     $pdf->SetFooterMargin(10);
     $pdf->SetAutoPageBreak(TRUE, 0);
     $pdf->SetFont('dejavusans', '', 7);
     $pdf->AddPage();
     $pdf->writeHTML($html, true, false, true, false, '');
     $pdf->LastPage();
     $pdf->Output("AcademicPeriod.pdf", "I");
 }
    public function actionMis_report()
    {
        $model = new FeesPaymentTransaction();
        $current_aca_term = AcademicTerm::model()->findAll(array('condition' => 'current_sem=1'));
        if ($current_aca_term) {
            $aca_data = array();
            foreach ($current_aca_term as $aca) {
                $aca_data[] = $aca['academic_term_id'];
                $current_aca_term = $aca->academic_term_period_id;
            }
            $acam_data = implode(",", $aca_data);
            //$current_aca_term = $current_aca_term->academic_term_period_id;
            $fees_data = Yii::app()->db->createCommand()->selectDistinct('fees_master_id, fees_branch_id, fees_academic_term_id,fees_quota_id, fees_academic_term_name_id')->from('fees_master')->where('fees_academic_term_name_id in(' . $acam_data . ') order by fees_branch_id,fees_academic_term_name_id')->queryAll();
            //print count($fees_data); exit;
            if (!empty($fees_data)) {
                foreach ($fees_data as $list) {
                    $ravi_paid = 0;
                    $ravi_total = 0;
                    $my_total = 0;
                    $receive_amount = 0;
                    if (!empty($list)) {
                        $sql = "SELECT COUNT(*) FROM student_transaction where student_transaction_quota_id=" . $list['fees_quota_id'] . " and student_transaction_branch_id = " . $list['fees_branch_id'] . " AND student_academic_term_period_tran_id = " . $list['fees_academic_term_id'] . " AND student_academic_term_name_id = " . $list['fees_academic_term_name_id'];
                        $numStud[] = Yii::app()->db->createCommand($sql)->queryScalar();
                        $ravi_total = Yii::app()->db->createCommand($sql)->queryScalar();
                        $paid_stud = Yii::app()->db->createCommand()->selectDistinct('fees.fees_student_id, stud.student_transaction_id,stud.student_transaction_student_id,stud.student_transaction_quota_id')->from('fees_payment_transaction fees')->join('student_transaction stud', 'fees.fees_student_id = stud.student_transaction_id')->where('stud.student_transaction_branch_id = :branch_id AND stud.student_transaction_quota_id=:quota AND stud.student_academic_term_period_tran_id = :acm_id AND fees.fees_academic_term_id = :acm_name_id', array(':branch_id' => $list['fees_branch_id'], ':acm_id' => $list['fees_academic_term_id'], ':acm_name_id' => $list['fees_academic_term_name_id'], ':quota' => $list['fees_quota_id']))->queryAll();
                        $paid_stud_count[] = count($paid_stud);
                        $ravi_paid = count($paid_stud);
                        $cash_amount = 0;
                        $cheque_amount = 0;
                        foreach ($paid_stud as $stud_id) {
                            $amount_data = FeesPaymentTransaction::model()->findAll('fees_student_id=' . $stud_id['student_transaction_id'] . ' and fees_academic_term_id=' . $list['fees_academic_term_name_id']);
                            foreach ($amount_data as $cash_cheque_list) {
                                if ($cash_cheque_list['fees_payment_method_id'] == 1) {
                                    $cash_amount += FeesPaymentCash::model()->findByPk($cash_cheque_list['fees_payment_cash_cheque_id'])->fees_payment_cash_amount;
                                } else {
                                    $amount = FeesPaymentCheque::model()->findByAttributes(array('fees_payment_cheque_status' => 0, 'fees_payment_cheque_id' => $cash_cheque_list->fees_payment_cash_cheque_id));
                                    $cheque_amount = $cheque_amount + $amount['fees_payment_cheque_amount'];
                                }
                            }
                        }
                        $total_receive_amount[] = $cash_amount + $cheque_amount;
                        $unpaid_stud = Yii::app()->db->createCommand()->selectDistinct('stud.student_transaction_id,stud.student_transaction_student_id,stud.student_transaction_quota_id')->from('student_transaction stud')->where('stud.student_transaction_id NOT IN (SELECT fees_student_id FROM fees_payment_transaction)
				AND stud.student_transaction_branch_id = :branch_id AND stud.student_academic_term_period_tran_id = :acm_id AND stud.student_academic_term_name_id = :acm_name_id', array(':branch_id' => $list['fees_branch_id'], ':acm_id' => $list['fees_academic_term_id'], ':acm_name_id' => $list['fees_academic_term_name_id']))->queryAll();
                        $unpaid_stud_count[] = $ravi_total - $ravi_paid;
                        //$unpaid_stud_count[] = count($unpaid_stud);
                        $total_amount_data = FeesMaster::model()->findAll('fees_branch_id =' . $list['fees_branch_id'] . ' AND
					  fees_academic_term_id =' . $list['fees_academic_term_id'] . ' AND
					  fees_academic_term_name_id =' . $list['fees_academic_term_name_id']);
                        $fees_stru = Yii::app()->db->createCommand()->select('fees.fees_master_id ,  stud.student_transaction_student_id, stud.student_academic_term_period_tran_id, stud.student_academic_term_name_id')->from('student_transaction stud')->join('fees_master fees', 'stud.student_transaction_branch_id = fees.fees_branch_id
		AND stud.student_academic_term_period_tran_id = fees.fees_academic_term_id
		AND stud.student_academic_term_name_id = fees.fees_academic_term_name_id 	

		AND stud.student_transaction_quota_id = fees.fees_quota_id')->where('stud.student_academic_term_period_tran_id = :term_p_id AND stud.student_academic_term_name_id = :term_name_id AND fees.fees_master_id = :fees_id', array(':fees_id' => $list['fees_master_id'], ':term_p_id' => $list['fees_academic_term_id'], ':term_name_id' => $list['fees_academic_term_name_id']))->queryAll();
                        //print_r($fees_stru); exit;
                        $total = 0;
                        foreach ($fees_stru as $fees_data1) {
                            $student_fees = StudentFeesMaster::model()->findAll('fees_master_table_id = :fees_master_id AND student_fees_master_student_transaction_id = :student_id', array(':fees_master_id' => $fees_data1['fees_master_id'], ':student_id' => $fees_data1['student_transaction_student_id']));
                            foreach ($student_fees as $fees_data1) {
                                $total += $fees_data1->fees_details_amount;
                            }
                        }
                        //print $total; exit;
                        $total_amount[] = $total;
                    }
                }
                if (isset($_REQUEST['MISexport'])) {
                    Yii::import('application.extensions.tcpdf.*');
                    require_once 'tcpdf/tcpdf.php';
                    require_once 'tcpdf/config/lang/eng.php';
                    $html = $this->renderPartial('report_view_pdf', array('numStud' => $numStud, 'fees_data' => $fees_data, 'paid_stud_count' => $paid_stud_count, 'unpaid_stud_count' => $unpaid_stud_count, 'total_amount' => $total_amount, 'total_receive_amount' => $total_receive_amount), true);
                    ob_clean();
                    $pdf = new TCPDF();
                    $pdf->SetCreator(PDF_CREATOR);
                    $pdf->SetAuthor(Yii::app()->name);
                    $pdf->SetTitle('MIS Report');
                    $pdf->SetSubject('MIS Report');
                    $pdf->SetKeywords('example, text, report');
                    $pdf->SetHeaderData('', 0, "Fees Summary", '');
                    //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Example Report by ".Yii::app()->name, "");
                    $pdf->setHeaderFont(array('helvetica', '', 8));
                    $pdf->setFooterFont(array('helvetica', '', 6));
                    $pdf->SetMargins(15, 18, 15);
                    $pdf->SetHeaderMargin(5);
                    $pdf->SetFooterMargin(10);
                    $pdf->SetAutoPageBreak(TRUE, 15);
                    $pdf->SetFont('dejavusans', '', 7);
                    $resolution = array(150, 150);
                    $pdf->AddPage('P', $resolution);
                    $pdf->writeHTML($html, true, false, true, false, '');
                    $pdf->LastPage();
                    $pdf->Output("MIS.pdf", "I");
                }
                if (isset($_REQUEST['MISexportexcel'])) {
                    Yii::app()->request->sendFile(date('YmdHis') . '.xlsx', $this->renderPartial('report_view_pdf', array('numStud' => $numStud, 'fees_data' => $fees_data, 'paid_stud_count' => $paid_stud_count, 'unpaid_stud_count' => $unpaid_stud_count, 'total_amount' => $total_amount, 'total_receive_amount' => $total_receive_amount), true));
                }
                $this->render('create_report', array('numStud' => $numStud, 'fees_data' => $fees_data, 'paid_stud_count' => $paid_stud_count, 'unpaid_stud_count' => $unpaid_stud_count, 'total_amount' => $total_amount, 'total_receive_amount' => $total_receive_amount));
            } else {
                $this->render('error_msg', array());
            }
        } else {
            echo "<font color=\"red\"><center>Data Not Available</center></font>";
        }
    }
 public function actionGeneratePdf()
 {
     $session = new CHttpSession();
     $session->open();
     Yii::import('application.extensions.ajaxgii.bootstrap.*');
     require_once 'tcpdf/tcpdf.php';
     require_once 'tcpdf/config/lang/eng.php';
     $Criteria = new CDbCriteria();
     $Criteria->condition = "id != -1";
     $model = Materia::model()->findAll($Criteria);
     $html = $this->renderPartial('expenseGridtoReport', array('model' => $model), true);
     $pdf = new TCPDF();
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor(Yii::app()->name);
     $pdf->SetTitle('Materia Report');
     $pdf->SetSubject('Materia Report');
     $pdf->SetHeaderData('', 0, "Report", '');
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Reporte generado por " . Yii::app()->name, "");
     $pdf->setHeaderFont(array('helvetica', '', 8));
     $pdf->setFooterFont(array('helvetica', '', 6));
     $pdf->SetMargins(15, 18, 15);
     $pdf->SetHeaderMargin(5);
     $pdf->SetFooterMargin(10);
     $pdf->SetAutoPageBreak(TRUE, 0);
     $pdf->SetFont('dejavusans', '', 7);
     $pdf->AddPage();
     $pdf->writeHTML($html, true, false, true, false, '');
     $pdf->LastPage();
     $pdf->Output("Materia_002.pdf", "I");
 }
 public function actionSelectedEmployeeList()
 {
     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 . ' emp.employee_transaction_organization_id=' . Yii::app()->user->getState('org_id'))->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);
         ob_clean();
         $pdf = new TCPDF();
         $pdf->SetCreator(PDF_CREATOR);
         $pdf->SetAuthor(Yii::app()->name);
         $pdf->SetTitle('EmployeeList Report');
         $pdf->SetSubject('EmployeeList Report');
         $pdf->SetKeywords('example, text, report');
         $pdf->SetHeaderData('', 0, "Employee Info Report", '');
         //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Example Report by ".Yii::app()->name, "");
         $pdf->setHeaderFont(array('helvetica', '', 8));
         $pdf->setFooterFont(array('helvetica', '', 6));
         $pdf->SetMargins(15, 18, 15);
         $pdf->SetHeaderMargin(5);
         $pdf->SetFooterMargin(10);
         $pdf->SetAutoPageBreak(TRUE, 15);
         $pdf->SetFont('dejavusans', '', 7);
         $resolution = array(150, 150);
         $pdf->AddPage('P', $resolution);
         $pdf->writeHTML($html, true, false, true, false, '');
         $pdf->LastPage();
         $pdf->Output("EmployeeInfoReport.pdf", "I");
     } 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 . ' emp.employee_transaction_organization_id=' . Yii::app()->user->getState('org_id'))->queryAll();
             Yii::app()->request->sendFile(date('YmdHis') . '.xlsx', $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');
 }
 public function actionGeneratePdf()
 {
     $session = new CHttpSession();
     $session->open();
     Yii::import('application.extensions.ajaxgii.bootstrap.*');
     require_once 'tcpdf/tcpdf.php';
     require_once 'tcpdf/config/lang/eng.php';
     if (isset($session['Plan_records'])) {
         $model = $session['Plan_records'];
     } else {
         $model = Plan::model()->findAll();
     }
     $criteria = new CDbCriteria();
     $criteria->order = 'anioPlan';
     $model = Plan::model()->findAll($criteria);
     $html = $this->renderPartial('expenseGridtoReport', array('model' => $model), true);
     //die($html);
     $pdf = new TCPDF();
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor(Yii::app()->name);
     $pdf->SetTitle('Plan Report');
     $pdf->SetSubject('Plan Report');
     //$pdf->SetKeywords('example, text, report');
     $pdf->SetHeaderData('', 0, "Report", '');
     $pdf->SetHeaderData(PDF_HEADER_LOGO, 10, "Reporte generado por " . Yii::app()->name, "");
     $pdf->setHeaderFont(array('helvetica', '', 8));
     $pdf->setFooterFont(array('helvetica', '', 6));
     $pdf->SetMargins(15, 18, 15);
     $pdf->SetHeaderMargin(5);
     $pdf->SetFooterMargin(10);
     $pdf->SetAutoPageBreak(TRUE, 0);
     $pdf->SetFont('dejavusans', '', 7);
     $pdf->AddPage();
     $pdf->writeHTML($html, true, false, true, false, '');
     $pdf->LastPage();
     $pdf->Output("Plan_002.pdf", "I");
 }
 public function exporttopdf($title, $filename, $html)
 {
     Yii::import('application.extensions.tcpdf.*');
     require_once 'tcpdf/tcpdf.php';
     require_once 'tcpdf/config/lang/eng.php';
     ob_clean();
     $pdf = new TCPDF();
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor(Yii::app()->name);
     $pdf->SetTitle($title);
     $pdf->SetSubject($title);
     $pdf->SetKeywords('example, text, report');
     $pdf->SetHeaderData('', 0, "Student Report", '');
     //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Example Report by ".Yii::app()->name, "");
     $pdf->setHeaderFont(array('helvetica', '', 8));
     $pdf->setFooterFont(array('helvetica', '', 6));
     $pdf->SetMargins(15, 18, 15);
     $pdf->SetHeaderMargin(5);
     $pdf->SetFooterMargin(10);
     $pdf->SetAutoPageBreak(TRUE, 15);
     $pdf->SetFont('dejavusans', '', 7);
     $resolution = array(150, 150);
     $pdf->AddPage('P', $resolution);
     $pdf->writeHTML($html, true, false, true, false, '');
     $pdf->LastPage();
     $pdf->Output($filename, "I");
 }