function print_report_pdf_A4($sample_id_array, $doctor) { $acr_check_code = array('-1' => '', '-2' => '', '-3' => '', '0' => '', '1' => 'low absurd', '2' => 'high absurd', '3' => 'low critical', '4' => 'high critical', '5' => 'low abnormal', '6' => 'high abnormal'); //A5=210,148 $attachment_exist = 'no'; $pdf = new MYPDF_NABL('P', 'mm', 'A4', true, 'UTF-8', false); $pdf->sample_id_array = $sample_id_array; $pdf->doctor = $doctor; $pdf->login = $_SESSION['login']; //$pdf->SetHeaderMargin(30); //$pdf->SetFooterMargin(30); // set default monospaced font //$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins //$pdf->SetMargins(10, 100); //set auto page breaks //$pdf->SetAutoPageBreak(TRUE, 30); //set image scale factor //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //$pdf->SetFont('times', '', 10); $pdf->SetFont('courier', '', 8); //$pdf->completed=''; foreach ($sample_id_array as $value) { $pdf->sample_id = $value; $pdf->startPageGroup(); $pdf->AddPage(); $linkk = start_nchsls(); $sql_examination_data = 'select * from examination where sample_id=\'' . $pdf->sample_id . '\' order by name_of_examination'; $result_examination_data = mysql_query($sql_examination_data, $linkk); $counter = $pdf->header_y + 5; $pdf->SetFont('courier', '', 10); $border = 0; while ($examination_array = mysql_fetch_assoc($result_examination_data)) { $counter = $counter + 5; if ($examination_array['id'] < 1000) { $pdf->SetFont('courier', '', 10); $pdf->SetXY(10, $counter); $pdf->Cell($w = 10, $h = 0, $examination_array['NABL_Accredited'], $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->SetXY(20, $counter); $pdf->Cell($w = 40, $h = 0, $examination_array['name_of_examination'], $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); /* $pdf->SetXY(60,$counter); $pdf->Cell($w=40, $h=0, $examination_array['result'],$border, $ln=0, $align='', $fill=false, $link='', $stretch=1, $ignore_min_height=false, $calign='T', $valign='M'); */ $pdf->SetXY(60, $counter); // $pdf->Cell($w=40, $h=0, $examination_array['result'],$border, $ln=0, $align='', $fill=false, $link='', // $stretch=1, $ignore_min_height=false, $calign='T', $valign='M'); //public function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0, $valign='T', $fitcell=false) { $pdf->MultiCell($w = 100, $h = 0, $examination_array['result'], $border, $align = '', $fill = false, $ln = 1, $x = $pdf->GetX(), $pdf->GetY(), $reseth = true, $stretch = 0, $ishtml = false, $autopadding = true, $maxh = 0, $valign = 'T', $fitcell = false); /* $pdf->SetXY(100,$counter); $pdf->Cell($w=40, $h=0, $examination_array['referance_range'].' '.$examination_array['unit'],$border, $ln=0, $align='', $fill=false, $link='', $stretch=1, $ignore_min_height=false, $calign='T', $valign='M'); $pdf->SetXY(140,$counter); $acr=$acr_check_code[check_critical_abnormal_reportable($pdf->sample_type,$examination_array['code'],$examination_array['result'])]; $pdf->Cell($w=20, $h=0,$acr,$border, $ln=0, $align='', $fill=false, $link='', $stretch=1, $ignore_min_height=false, $calign='T', $valign='M'); $pdf->SetXY(160,$counter); $pdf->Cell($w=40, $h=0,$examination_array['method_of_analysis'],$border, $ln=0, $align='', $fill=false, $link='', $stretch=1, $ignore_min_height=false, $calign='T', $valign='M'); */ if ($counter >= 260) { $counter = $pdf->header_y + 5; $pdf->AddPage(); } //148=120+28 297=270+27 } else { if ($examination_array['id'] == 1008) { $attachment_exist = 'yes'; } $counter = $counter + 2; $pdf->SetFont('courier', 'B', 12); $pdf->SetXY(10, $counter); $pdf->Cell($w = 50, $h = 0, trim($examination_array['name_of_examination'], 'Z_'), $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->SetFont('courier', '', 10); $pdf->SetXY(60, $counter); $pdf->Cell($w = 140, $h = 0, $examination_array['result'], $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); if ($counter >= 260) { $counter = $pdf->header_y + 5; $pdf->AddPage(); } } } if ($attachment_exist == 'yes') { //echo '<h2 style="page-break-before: always;"></h2>'; $y = print_attachment_A4($pdf, $pdf->sample_id, $counter); $counter = $y; } } $pdf->Output('report.pdf', 'I'); }
function print_report_pdf_A5($sample_id_array, $doctor) { $acr_check_code = array('-1' => '', '-2' => '', '-3' => '', '0' => '', '1' => 'low absurd', '2' => 'high absurd', '3' => 'low critical', '4' => 'high critical', '5' => '', '6' => ''); //A5=210,148 $pdf = new MYPDF_NABL('L', 'mm', 'A5', true, 'UTF-8', false); $pdf->sample_id_array = $sample_id_array; $pdf->doctor = $doctor; $pdf->login = $_SESSION['login']; // set default monospaced font //$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(10, 50); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, 10); //set image scale factor //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //$pdf->SetFont('times', '', 10); $pdf->SetFont('helvetica', '', 8); foreach ($sample_id_array as $value) { $pdf->sample_id = $value; $pdf->startPageGroup(); $pdf->AddPage(); $linkk = start_nchsls(); $sql_examination_data = 'select * from examination where sample_id=\'' . $pdf->sample_id . '\' order by name_of_examination'; $result_examination_data = mysql_query($sql_examination_data, $linkk); $counter = 45; $pdf->SetFont('helvetica', '', 10); $border = 0; while ($examination_array = mysql_fetch_assoc($result_examination_data)) { $counter = $counter + 5; if ($examination_array['id'] < 1000) { //available 190 mm //10+40+40+40+20+40 $pdf->SetXY(10, $counter); $pdf->Cell($w = 10, $h = 0, $examination_array['NABL_Accredited'], $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->SetXY(20, $counter); $pdf->Cell($w = 40, $h = 0, $examination_array['name_of_examination'], $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->SetXY(60, $counter); $pdf->Cell($w = 40, $h = 0, $examination_array['result'], $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->SetXY(100, $counter); $pdf->Cell($w = 40, $h = 0, $examination_array['referance_range'] . ' ' . $examination_array['unit'], $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->SetXY(140, $counter); $acr = $acr_check_code[check_critical_abnormal_reportable($examination_array['sample_id'], $examination_array['code'])]; $pdf->Cell($w = 20, $h = 0, $acr, $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->SetXY(160, $counter); $pdf->Cell($w = 40, $h = 0, $examination_array['method_of_analysis'], $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); if ($counter >= 120) { $counter = 45; $pdf->AddPage(); } } else { $pdf->SetXY(10, $counter); $pdf->Cell($w = 50, $h = 0, trim($examination_array['name_of_examination'], 'Z_'), $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->SetXY(60, $counter); $pdf->Cell($w = 140, $h = 0, $examination_array['result'], $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); if ($counter >= 120) { $counter = 45; $pdf->AddPage(); } } } } $pdf->Output('report.pdf', 'I'); }
$pdf->SetFont('times', '', 10); $acr_check_code = array('-1' => '', '-2' => '', '-3' => '', '0' => '', '1' => 'low absurd', '2' => 'high absurd', '3' => 'low critical', '4' => 'high critical', '5' => '', '6' => ''); // add a page $pdf->AddPage(); $wth = $pdf->getPageWidth() - 10; $linkk = start_nchsls(); $sql_examination_data = 'select * from examination where sample_id=\'' . $sample_id . '\' order by name_of_examination'; $result_examination_data = mysql_query($sql_examination_data, $linkk); $counter = 55; $pdf->SetFont('helvetica', '', 8); while ($examination_array = mysql_fetch_assoc($result_examination_data)) { //if($examination_array['id']<1000) //{ $pdf->SetY($counter); $counter = $counter + 5; $pdf->Cell($w = $wth * 0.1, $h = 0, $examination_array['NABL_Accredited'], $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->Cell($w = $wth * 0.2, $h = 0, $examination_array['name_of_examination'], $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->Cell($w = $wth * 0.2, $h = 0, $examination_array['result'], $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->Cell($w = $wth * 0.2, $h = 0, $examination_array['referance_range'] . ' ' . $examination_array['unit'], $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $acr = $acr_check_code[check_critical_abnormal_reportable($examination_array['sample_id'], $examination_array['code'])]; $pdf->Cell($w = $wth * 0.1, $h = 0, $acr, $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->Cell($w = $wth * 0.2, $h = 0, $examination_array['method_of_analysis'], $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); //} //else //{ // $pdf->SetY($counter);$counter=$counter+5; // $pdf->Cell($w=$wth*0.2, $h=0, $examination_array['name_of_examination'],$border=0, $ln=0, $align='', $fill=false, $link='', // $stretch=1, $ignore_min_height=false, $calign='T', $valign='M'); // $pdf->Cell($w=$wth*0.8, $h=0, $examination_array['result'],$border=0, $ln=0, $align='', $fill=false, $link='', // $stretch=1, $ignore_min_height=false, $calign='T', $valign='M'); //}