}
        echo '<td style=\'' . $style . '\'>' . $key . '=>' . $value . '</td>';
    }
    echo '</tr></table>';
    echo '<div id=display>';
    foreach ($sample_id_array as $key => $value) {
        edit_sample($value, '', 'disabled', 'no');
        edit_examination($value, '', 'disabled');
    }
    echo '</div>';
}
main_menu();
//find_next_sample_id_for_OPD();
if (isset($_POST['action'])) {
    if ($_POST['action'] == 'insert_new') {
        if (is_str_digit($_POST['mrd']) !== FALSE && strlen($_POST['name']) != 0 && strlen($_POST['selected_department']) != 0 && strlen($_POST['selected_sample_details']) != 0) {
            if (strlen($_POST['mrd']) <= 8) {
                if (insert_required_samples($_POST) === FALSE) {
                    echo '<h2 style="color:red;">No examination selected or sample id  can not allocated</h2>';
                }
            } else {
                echo '<h2 style="color:red;">MRD number must be 8 or less digit</h2>';
            }
        } else {
            echo '<h2 style="color:red;">Name:(not blank) MRD:(only digits, not blank) (dept:select) (sample_details:select)</h2>';
        }
    }
}
get_patient_and_sample_data();
echo '<h2 style="color:red;">Only for location=OPD, Unit=- sample_type=Blood(Serum,Plasma) </h2>';
echo '<h2 style="color:red;">Never refresh the page</h2>';
function analyse_examination_request($post)
{
    $requested_examination = array();
    /*
                [name] => ABC
                [mrd] => 345
                [selected_department] => Dentistry
                [selected_unit] => 1
                [selected_location] => E4(510)
                [selected_sample_type] => Blood(Serum,Plasma)
                [selected_preservative] => Fluoride
                [selected_preservative] => Random
    */
    if (strlen($post['name']) == 0 || strlen($post['mrd']) == 0 || is_str_digit($post['mrd']) == FALSE || strlen($post['selected_department']) == 0 || strlen($post['selected_unit']) == 0 || strlen($post['selected_location']) == 0 || strlen($post['selected_sample_type']) == 0 || strlen($post['selected_preservative']) == 0 || strlen($post['selected_sample_details']) == 0) {
        echo "<h3>Something was not selected at all</h3><br>";
        return $requested_examination;
    }
    foreach ($post as $key => $value) {
        $exploded_result = explode("|", $key);
        //print_r($exploded_result);
        if ($exploded_result[0] == 'examination' && $value == 'yes') {
            if (in_array($exploded_result[1], $requested_examination) === FALSE) {
                $requested_examination[] = $exploded_result[1];
            }
        }
        if ($exploded_result[0] == 'profile' && $value == 'yes') {
            $link = start_nchsls();
            $sql = 'select * from profile where profile=\'' . $exploded_result[1] . '\'';
            $result = mysql_query($sql, $link);
            while ($profile_row = mysql_fetch_assoc($result)) {
                foreach ($profile_row as $key => $value) {
                    if ($key != 'profile' && $key != 'sample_type' && $key != 'preservative') {
                        if ($value > 0) {
                            if (in_array($value, $requested_examination) === FALSE) {
                                $requested_examination[] = $value;
                            }
                        }
                    }
                }
            }
        }
    }
    return $requested_examination;
}
Exemplo n.º 3
0
function new_letter($id)
{
    if (is_str_digit($id)) {
        $sql = 'insert into letter (id,type,`from`,`to`,`date`,greeting,subject,sub_subject,`reference`,`body`,closing,thanks,signature,attachment_list,copy_to)
			values
			(\'' . $id . '\'
			\'\',
			\'\',
			\'\',
			\'\',
			\'' . mysql_real_escape_string(strftime("%Y-%m-%d")) . '\',
			\'\',
			\'\',
			\'\',
			\'\',
			\'\',			
			\'\',	
			\'\',
			\'\',
			\'\',
			\'\')';
        //echo $sql;
        $link = start_nchsls();
        if (!($result = mysql_query($sql, $link))) {
            echo mysql_error();
        }
        return mysql_insert_id($link);
    } else {
        echo 'id not numeric<br>';
        return FALSE;
    }
}
            }
        }
        echo '<td style=\'' . $style . '\'>' . $key . '=>' . $value . '</td>';
    }
    echo '</tr></table>';
    echo '<div id=display>';
    foreach ($sample_id_array as $key => $value) {
        edit_sample($value, '', 'disabled', 'no');
        edit_examination($value, '', 'disabled');
    }
    echo '</div>';
}
main_menu();
if (isset($_POST['action'])) {
    if ($_POST['action'] == 'insert_new_1') {
        if (strlen($_POST['name']) == 0 || strlen($_POST['mrd']) == 0 || is_str_digit($_POST['mrd']) == FALSE || strlen($_POST['selected_department']) == 0 || strlen($_POST['selected_unit']) == 0 || strlen($_POST['selected_location']) == 0 || strlen($_POST['selected_sample_details']) == 0) {
            echo "<h3>Something was not selected/filled at all. Re enter</h3><br>";
            get_patient_data();
        } else {
            echo '<form method=post>';
            echo '<table><tr>';
            echo '<td><input type=text readonly name=name value=\'' . $_POST['name'] . '\'></td>';
            echo '<td><input type=text readonly name=mrd value=\'' . $_POST['mrd'] . '\'></td>';
            echo '<td><input type=text readonly name=selected_department  value=\'' . $_POST['selected_department'] . '\'></td>';
            echo '<td><input type=text readonly name=selected_unit value=\'' . $_POST['selected_unit'] . '\'></td>';
            echo '<td><input type=text readonly name=selected_location value=\'' . $_POST['selected_location'] . '\'></td>';
            echo '<td><input type=text readonly name=selected_sample_details value=\'' . $_POST['selected_sample_details'] . '\'></td>';
            echo '</tr><tr>';
            get_examination_data_grand();
            echo '</form>';
        }
         }
     }
     search_form($list_of_sample);
 } else {
     if ($_POST['submit'] == 'print') {
         if (isset($_POST['authorized_signatory'])) {
             if (strlen($_POST['authorized_signatory']) == 0) {
                 echo '<h4>No authorized Signatory given</h4>';
                 //main_menu();
                 exit(0);
             }
         }
         $temp_list_of_sample = explode("|", $list_of_sample);
         $final_list_of_sample = array();
         foreach ($temp_list_of_sample as $value) {
             if (is_str_digit($value) !== FALSE) {
                 if (in_array($value, $final_list_of_sample) === FALSE) {
                     $final_list_of_sample[] = $value;
                 }
             }
         }
         foreach ($final_list_of_sample as $value) {
             if (get_sample_status($value) != 'verified') {
                 echo $value . ' is not verified. PDF report can not be printed<br>';
                 exit(0);
             }
         }
         //print_r($final_list_of_sample);
         print_report_pdf_A4($final_list_of_sample, $_POST['authorized_signatory']);
     }
 }