include_once $root_path . 'include/care_api_classes/class_paginator.php';
 $pagen =& new Paginator($pgx, $thisfile, $_SESSION['sess_searchkey'], $root_path);
 $GLOBAL_CONFIG = array();
 include_once $root_path . 'include/care_api_classes/class_globalconfig.php';
 $glob_obj = new GlobalConfig($GLOBAL_CONFIG);
 # Get the max nr of rows from global config
 $glob_obj->getConfig('pagin_patient_search_max_block_rows');
 if (empty($GLOBAL_CONFIG['pagin_patient_search_max_block_rows'])) {
     $pagen->setMaxCount(MAX_BLOCK_ROWS);
 } else {
     $pagen->setMaxCount($GLOBAL_CONFIG['pagin_patient_search_max_block_rows']);
 }
 $encounter =& $lab_obj->searchPatientWithPendingLabResults($keyword, $pagen->MaxCount(), $pgx, $oitem, $odir);
 //echo $lab_obj->getLastQuery()."<p>";
 # Get the resulting record count
 if ($linecount = $lab_obj->LastRecordCount()) {
     if ($mode != 'paginate') {
         $_SESSION['sess_searchkey'] = $keyword;
     }
     $pagen->setTotalBlockCount($linecount);
     # Count total available data
     if (isset($totalcount) && $totalcount) {
         $pagen->setTotalDataCount($totalcount);
     } else {
         if ($editmode) {
             @$lab_obj->searchEncounterLaboratoryInfo($keyword);
         } else {
             @$lab_obj->searchEncounterLabResults($keyword);
         }
         $totalcount = $lab_obj->LastRecordCount();
         $pagen->setTotalDataCount($totalcount);
    }
    return $txt;
}
require $root_path . 'include/inc_labor_param_group.php';
if ($nostat) {
    $ret = $root_path . "modules/laboratory/labor_data_patient_such.php?sid={$sid}&lang={$lang}&versand=1&keyword={$pn}";
} else {
    $ret = $root_path . "modules/nursing/nursing-station-patientdaten.php?sid={$sid}&lang={$lang}&station={$station}&pn={$pn}";
}
# Load the date formatter
require_once $root_path . 'include/inc_date_format_functions.php';
$enc_obj->setWhereCondition("encounter_nr='{$encounter_nr}'");
if ($encounter = $enc_obj->getBasic4Data($encounter_nr)) {
    $patient = $encounter->FetchRow();
    $recs =& $lab_obj->getAllResults($encounter_nr);
    if ($rows = $lab_obj->LastRecordCount()) {
        # Merge the records to common date key
        $records = array();
        $dt = array();
        while ($buffer = $recs->FetchRow()) {
            $tmp = array($buffer['paramater_name'] => $buffer['parameter_value']);
            $records[$buffer['job_id']][] = $tmp;
            $tdate[$buffer['job_id']] =& $buffer['test_date'];
            $ttime[$buffer['job_id']] =& $buffer['test_time'];
        }
        //gjergji :
        //reverse date from past to current
        //had to use $tdatePrint for the array_reverse() to work...
        $tdatePrint = array_reverse($tdate, true);
        $tdate = array_reverse($tdate);
        $ttime = array_reverse($ttime);
*
* See the file "copy_notice.txt" for the licence notice
*/
$lang_tables = array('chemlab_groups.php');
define('LANG_FILE', 'lab.php');
$local_user = '******';
require_once $root_path . 'include/inc_front_chain_lang.php';
require_once $root_path . 'include/care_api_classes/class_lab.php';
$thisfile = 'labor_data_check_arch.php';
$breakfile = 'labor_data_patient_such.php' . URL_APPEND . '&mode=edit';
$toggle = 0;
$lab_obj = new Lab();
# Load the date formatter
require_once $root_path . 'include/inc_date_format_functions.php';
$lab_results =& $lab_obj->createResultsList($encounter_nr);
$linecount = $lab_obj->LastRecordCount();
if (!$linecount) {
    switch ($mode) {
        case 'list':
            header("location:pflege-station-patientdaten.php" . URL_REDIRECT_APPEND . "&station={$station}&pn={$encounter_nr}&nodoc=labor");
            break;
        default:
            header("location:labor_datainput.php" . URL_REDIRECT_APPEND . "&encounter_nr={$encounter_nr}&newid=1&mode={$mode}");
    }
}
?>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
<?php 
html_rtl($lang);
?>
<HEAD>