$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);
        }
        $pagen->setSortItem($oitem);
        $pagen->setSortDirection($odir);
    }
}
?>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
<?php 
html_rtl($lang);
?>
<HEAD>
<?php