if ($_POST['action'] == 'edit_attachment') { edit_attachment($_POST['sample_id'], $_POST['attachment_id']); } if ($_POST['action'] == 'add_attachment') { add_attachment($_POST['sample_id']); } if ($_POST['action'] == 'save_attachment') { if (isset($_FILES)) { save_attachment($_POST, $_FILES); } list_attachment($_POST['sample_id']); } if ($_POST['action'] == 'insert_attachment') { if (isset($_FILES)) { insert_attachment($_POST, $_FILES); } update_cross_reference($_POST['sample_id']); list_attachment($_POST['sample_id']); } if ($_POST['action'] == 'delete_attachment') { if (isset($_FILES)) { delete_attachment($_POST['sample_id'], $_POST['attachment_id']); } update_cross_reference($_POST['sample_id']); list_attachment($_POST['sample_id']); } if ($_POST['action'] == 'print_attachment') { echo '<h2 style="page-break-before: always;"></h2>'; print_attachment($_POST['sample_id']); } }
function print_sample($sample_id, $Technician, $Doctor) { global $lab_name, $section_name, $address_phone, $nabl_symbol, $blank_symbol, $nabl_cert_no, $blank_cert_no, $bypass_autoverification; $attachment_exist = 'no'; $link = start_nchsls(); $sql_sample_data = 'select * from sample where sample_id=' . $sample_id; $sql_examination_data = 'select * from examination where sample_id=\'' . $sample_id . '\' order by name_of_examination'; global $acr_check_code; ////////find if any one is accredited $NABL_acc_counter = 0; $result_examination_data_for_accr = mysql_query($sql_examination_data, $link); while ($acc_array = mysql_fetch_assoc($result_examination_data_for_accr)) { if ($acc_array['NABL_Accredited'] == 'Yes') { $NABL_acc_counter++; } } if ($NABL_acc_counter > 0) { $symbol = $nabl_symbol; $cert_no = $nabl_cert_no; } else { $symbol = $blank_symbol; $cert_no = $blank_cert_no; } ///////////////////// if (mysql_num_rows($result_sample_data = mysql_query($sql_sample_data, $link)) > 0) { $sample_array = mysql_fetch_assoc($result_sample_data); echo ' <table border=0 style="border-collapse:collapse;">'; if (strlen($Doctor) > 0) { echo '<tr> <td colspan=20 align=center> <table border=0> <tr><th colspan=20><u><h2>' . $lab_name . '</h2></u></td></tr> <tr><th colspan=2 align=center>' . $address_phone . '</td></td></tr> <tr> <td> <table border=0> <tr><td align=center ><img src="' . $symbol . '" height="96" width=90" /></td></tr> <tr><td width=10 align="center"><font size="1">' . $cert_no . '</font></td></tr> </table> </td> <td> <table border=0> <tr><th halign=center>Laboratory Examination Report</th></tr> <tr><th align=center>' . $section_name . '</th></tr> </table> </td> </tr> </table> </td> </tr>'; } else { echo '<tr><th colspan=10><font color=red>THIS IS NOT A REPORT. DO NOT PRINT</font></th></tr>'; } echo '<tr style="border:1px solid #000;"> <td> <table border=0> <tr><td><b>Patient Name</b></td><td>' . $sample_array['patient_name'] . '</td></tr> <tr><td><b>MRD Number</b></td><td>' . $sample_array['patient_id'] . '</td></tr> </table> </td> <td align=right> <table border=0> <tr><td><b>' . $sample_array['clinician'] . '</td><td><b>Unit:</b>' . $sample_array['unit'] . '</td></tr> <tr><td><b>Ward/OPD</b></td><td>' . $sample_array['location'] . '</td></tr> </table> </td> </tr> <tr style="border:1px solid #000;"> <td> <table border=0> <tr><td style=\'font-size:150%\'>Sample ID:<b>' . $sample_array['sample_id'] . '</b>('; //comment line below when bypassing autoverification echo $sample_array['status']; echo ')</td></tr> <tr><td><b>' . $sample_array['sample_details'] . '</b></td></tr> </table> </td> <td align=right> <table border=0> <tr><td><b>Sample Type:</b>' . $sample_array['sample_type'] . '</td></tr> <tr><td><b>Preservative:</b>' . $sample_array['preservative'] . '</td></tr> </table> </td> </tr>'; echo ' <tr style="border:1px solid #000;"><td colspan=3><b>Collection time/Diagnosis/Age/Sex:</b>' . $sample_array['sample_collection_time'] . '</b></td></tr> <tr style="border:1px solid #000;"><td><b>Receipt Time:</b>' . $sample_array['sample_receipt_time'] . '</td><td align=right><b>Report time:</b>' . strftime('%Y-%m-%d %H:%M:%S') . '</td></tr> '; if (mysql_num_rows($result_examination_data = mysql_query($sql_examination_data, $link)) > 0) { //<table border=0 RULES=COLS FRAME=BOX style="border-collapse:collapse; margin-top:50px"> echo ' <tr><td colspan=2> <table border=1 style="border-collapse:collapse; margin-top:50px"> <tr> <th>Accr.</th> <th>Examination</th> <th>Result</th> <th>Ref.R</th> <th>Alert</th> <th>Method</th> </tr>'; while ($examination_array = mysql_fetch_assoc($result_examination_data)) { if ($examination_array['id'] < 1000) { echo '<tr>'; echo '<td>' . $examination_array['NABL_Accredited'] . '</td>'; echo '<td>' . $examination_array['name_of_examination'] . '</td>'; echo '<td>' . $examination_array['result'] . '</td>'; echo '<td>' . $examination_array['referance_range'] . ' ' . $examination_array['unit'] . '</td>'; echo '<td>'; echo $acr_check_code[check_critical_abnormal_reportable($sample_array['sample_type'], $examination_array['code'], $examination_array['result'])]; echo '</td>'; echo '<td>' . $examination_array['method_of_analysis'] . '</td>'; //echo '<td>'.$examination_array['details'].'</td>'; echo '</tr>'; } elseif ($examination_array['id'] >= 1000) { if ($examination_array['id'] == 1008) { $attachment_exist = 'yes'; } echo ' <tr> <td colspan="10" > <table border=0> <tr> <tr><td><b>' . trim($examination_array['name_of_examination'], 'Z_') . ':</b></td><td>' . $examination_array['result'] . '</td></tr> </tr> </table> </td> </tr>'; } } echo '<tr><th colspan=20>The tests marked with \'No\' in the first column are not accredited by NABL</th></tr>'; echo '</table>'; } echo ' <tr> <td colspan=24 align=center> <table border=1 style="border-collapse:collapse; margin-top:50px"> <tr> <td>Sign:</td></td><td width=200></td><td rowspan=2 width=150></td> <td>Sign:</td><td width=200></td> </tr> <tr> <td align=center colspan=2>' . $Technician . '</td> <td align=center colspan=2>' . $Doctor . '</td> </tr> </table> </td> </tr> '; if ($attachment_exist == 'no') { echo '<tr><td align=center colspan=6>-----End of Report-----</td></tr>'; } echo '</table>'; if ($attachment_exist == 'yes') { echo '<h2 style="page-break-before: always;"></h2>'; print_attachment($sample_id); } //return TRUE; } else { return FALSE; } }