function generatePDFReport(&$response, $title, $o_id, $sem, $ac_id, $div, array $sub_id = array(), $lec_type = 2, $batchno = null, $ltgt = null, $percentage = null, $sub_filter = null) { if (generateHTMLReport($data, $title, $o_id, $sem, $ac_id, $div, $sub_id, $lec_type, $batchno, $ltgt, $percentage, $sub_filter)) { //echo $data; // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('SAL AMS'); $pdf->SetTitle('Report - ' . strtoupper($title)); $pdf->SetSubject('Attendance Report'); //var_dump($_SESSION); $pdf->SetHeaderData(null, 0, strtoupper($title), "Attendance Management System\nDate: " . (new DateTime())->format("d-m-Y")); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font //$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // add a page $pdf->AddPage(); // Write HTML table to PDF document $pdf->SetFont('times', '', 12); $pdf->writeHTML($data, true, false, false, false, ''); //Close and output PDF document header('Content-type: application/pdf'); $pdf->Output('Report_' . (new DateTime())->format("d-m-Y"), 'I'); return true; } $response = $data; return false; }
$_POST['division'] = empty($_POST['division']) ? "" : $_POST['division']; $_POST['percentage'] = empty($_POST['percentage']) ? null : floatval($_POST['percentage']); if (strcmp($_POST['ltgt'], "lte") == 0) { $_POST['ltgt'] = "<="; } else { if (strcmp($_POST['ltgt'], "gte") == 0) { $_POST['ltgt'] = ">="; } else { $_POST['ltgt'] = null; } } $_POST['sub_id'] = !isset($_POST['sub_id']) || !is_array($_POST['sub_id']) ? array() : $_POST['sub_id']; //var_dump($_POST); if (strcmp($_POST['report_format'], "pdf") == 0 && generatePDFReport($data, $_POST['title'], $_POST['o_id'], $_POST['sub_offered_sem'], $_POST['ac_id'], $_POST['division'], $_POST['sub_id'], $_POST['type'], $_POST['batchno'], $_POST['ltgt'], $_POST['percentage'], $_POST['sub_filter'])) { } else { if (strcmp($_POST['report_format'], "html") == 0 && generateHTMLReport($data, $_POST['title'], $_POST['o_id'], $_POST['sub_offered_sem'], $_POST['ac_id'], $_POST['division'], $_POST['sub_id'], $_POST['type'], $_POST['batchno'], $_POST['ltgt'], $_POST['percentage'], $_POST['sub_filter'])) { $html = <<<EOF <!DOCTYPE HTML> <HTML> \t<HEAD> \t\t<TITLE>Report - {$_POST['title']}</TITLE> \t\t<LINK href="{$dir}include/bootstrap.min.css" media="screen" type="text/css" rel="stylesheet"> \t\t<LINK rel="stylesheet" href="{$dir}include/report_print.css" type="text/css" media="print"/> \t\t<LINK rel="stylesheet" href="{$dir}include/report_screen.css" type="text/css" media="screen"/> \t\t<LINK href="{$dir}include/main.css" media="screen" type="text/css" rel="stylesheet"> \t\t<script src="{$dir}include/js/jquery-1.10.2.min.js" type="text/javascript"></script> \t\t<script src="{$dir}include/js/bootstrap.min.js" type="text/javascript"></script> \t\t<script src="{$dir}include/my_js/report_edit.js" type="text/javascript"></script> \t\t<style media="screen" type="text/css"> \t\t\tbody{ \t\t\t\tpadding-top:0px;