Source code Run ผ่านหมด ยกเว้น Chrome ค้าง Run ไม่ผ่านครับ
<?
session_start() ;
//******************************************************************************************
// get login variable from session to local variable
$login_name = $_SESSION['login_name'] ;
$login_password = $_SESSION['login_password'] ;
$ls_hospital_id = $_SESSION['hospital_id'] ;
$ls_hospital_prename = $_SESSION['hospital_prename'] ;
$ls_hospital_name = $_SESSION['hospital_name'] ;
//******************************************************************************************
//echo date("h:i:s a", time());
//$ll_page = $HTTP_GET_VARS["Page"] ;
//$Pagesize = 50 ;
//$ll_page = $HTTP_SET_VARS[$Pagesize] ;
//$HTTP_GET_VARS["$Pagesize"] ;
//echo $ll_page ;
//******************************************************************************************
// check ls_hospital_name empty - not data in session variable
if( $ls_hospital_name == "")
{
echo '<meta http-equiv="refresh" content="0; URL=index.htm">' ;
exit ;
}
function f_set_patient_name( $as_prename, $as_fname, $as_lname)
{
$ls_prename = $as_prename ;
$ls_fname = $as_fname ;
$ls_lname = $as_lname ;
if (is_null( $ls_prename) )
{
$ls_prename = "" ;
}
if (is_null( $ls_fname) )
{
$ls_fname = "" ;
}
if (is_null( $ls_lname) )
{
$ls_lname = "" ;
}
$ls_patient_name = $ls_prename . $ls_fname . ' ' . $ls_lname ;
return $ls_patient_name ;
}
// set surgical number with number zero leading
function f_setcn( $al_year, $al_no, $al_type_id)
{
$ls_year = strval( $al_year ) ;
$ll_strlen = strlen ( $ls_year) ;
if ($ll_strlen == 1 )
{
$ls_year = "0" . $ls_year ;
}
$ls_no = strval( $al_no ) ;
$ll_strlen = strlen ( $ls_no) ;
if ($ll_strlen == 4 )
{
$ls_no = "0" . $ls_no ;
}
if ($ll_strlen == 3 )
{
$ls_no = "00" . $ls_no ;
}
if ($ll_strlen == 2 )
{
$ls_no = "000" . $ls_no ;
}
if ($ll_strlen == 1 )
{
$ls_no = "0000" . $ls_no ;
}
$ls_set_cn = $ls_year . '-' . $ls_no ;
if( $al_type_id == 3)
{
$ls_set_cn = "C" . $ls_set_cn ;
}
if( $al_type_id == 4)
{
$ls_set_cn = "C" . $ls_set_cn ;
}
if( $al_type_id == 5)
{
$ls_set_cn = "T" . $ls_set_cn ;
}
return $ls_set_cn ;
}
// rearrange date format to dd/mm/yyy hh:mm
function f_setdate( $adt_datetime, $al_datetype)
{
$ls_datetime = strval( $adt_datetime ) ;
$ls_year = substr( $ls_datetime, 0, 4) ;
$ls_month = substr( $ls_datetime, 5, 2) ;
$ls_day = substr( $ls_datetime,8, 2) ;
$ls_hour = substr( $ls_datetime, 11, 2) ;
$ls_minute = substr( $ls_datetime, 14, 2) ;
if( $al_datetype == 1)
{
// 1 is date only
$ls_setdate = $ls_day . '/' . $ls_month . '/' . $ls_year ;
}
else
{
// 2 or other value date and time
$ls_setdate = $ls_day . '/' . $ls_month . '/' . $ls_year . ' ' . $ls_hour . ':' . $ls_minute ;
}
return $ls_setdate ;
}
//**************************************************************************************************
echo '<HTML>';
echo '<HEAD>';
//echo '<title>BROWSE CYTOLOGY REPORT - Professional Laboratory Management Corp. Co., Ltd.</title>';
echo '<meta http-equiv="Content-Type" content="text/html; charset=tis-620">';
echo '<script src="../../select-and-go.js"></script>';
echo '<style type="text/css">';
echo '<!--';
echo 'body { margin: 0px 0px; padding: 0px 0px}';
echo 'a:link { color: #005CA2; text-decoration: none}';
echo 'a:visited { color: #005CA2; text-decoration: none}';
echo 'a:active { color: #0099FF; text-decoration: underline}';
echo 'a:hover { color: #0099FF; text-decoration: underline}';
echo '.cs_text1 { font-family: "MS Sans Serif", "Microsoft Sans Serif"; font-size: 10px; font-style: normal; font-weight: normal; color: #0000FF}';
echo '.cstext1bold { font-family: "MS Sans Serif", "Microsoft Sans Serif"; font-size: 15px; font-weight: bold; color: #0000FF}';
echo '.cstextboldwhite { font-family: "MS Sans Serif", "Microsoft Sans Serif"; font-size: 16px; font-weight: bold; color: #FFFFFF}';
echo '-->';
echo '</style>';
echo '<script language="Javascript" type="text/javascript">';
echo ' <!-- Hide scriptfrom older browsers';
echo 'function jumpPage(as_lsn)' ;
echo '{ ' ;
echo ' alert("Please enter your password .")';
echo '}' ;
echo ' // END hiding script -->';
echo '</script>';
echo '</HEAD>';
echo '<body">';
echo' <table width="700" border="0">' ;
echo' <tr> ' ;
echo' <td ><img src="images/logo.gif" width="169" height="80"></td>' ;
echo' </tr>' ;
echo' </table>' ;
echo '<br>';
//******************************************************************************************
//******************************************************************************************
// assign db variable
$db_server_name = "webserver"; // server name
$db_dsn = "msight" ; // dsn name, must create datasource in system tab
$db_username = "sa"; // user name
$db_password = ""; // password
$dbname = "msight"; // db name
//******************************************************************************************
//******************************************************************************************
// connect MSSQL Server
$db_connect = odbc_connect( $db_dsn, $db_username, $db_password) or die("Cannot connect to MSight DB");
//******************************************************************************************
// prepare sql statementhospital
//$db_sql = "select * from tblpatient where hospital_id='$ll_hospital_id' order by 'patient_year' desc , 'patient_no' desc";
//$db_sql = "select * from tblbrowse_cyto_view where hospital_id='$ll_hospital_id' order by 'patient_year' desc , 'patient_no' desc"; order by print_date desc";
$db_sql = "select * from tblbrowse_cyto_view where hospital_id='$ls_hospital_id' order by patient_no ";
// execute SQL statement
$db_exec = odbc_exec( $db_connect, $db_sql ) or die ("Query cannot execute.");
// find number of retrieved row
$ll_num_rows = odbc_num_rows( $db_exec );
//echo $ll_num_rows ;
// set row color
//$bgcolor = "#009900" ;
$bgcolor = "#66FFCC" ;
// row retrieved
if ( $ll_num_rows != 0 )
{
echo '<table width="700" border="0">';
echo ' <tr> ';
echo ' <td colspan="30"> <div align="center" class="cstext1bold">PROLAB PATHOLOGY REPORT</di></td>';
echo ' </tr>';
echo ' <tr> ';
echo ' <td colspan="30"><div align="center">Click on patient name to view report</div></td>';
echo ' </tr>';
echo ' <tr> ';
echo ' <td colspan="30"><div align="center"><a href="http://192.168.0.136/prolab-lis/">Home | <a href="search_rep.htm">Search Report</a> </a></div></td>';
echo ' </tr>';
echo ' <tr> ';
echo ' <td colspan="30"><hr></td>';
echo ' </tr>';
echo ' <tr> ';
echo ' <td colspan="4"><div align="center">CN</div></td>';
echo ' <td colspan="5"><div align="center">HN</div></td>';
echo ' <td colspan="14"><div align="center">PATIENT NAME</div></td>';
echo ' <td colspan="3"><div align="center">AGE</div></td>';
echo ' <td colspan="4"><div align="center">RECEIVED DATE</div></td>';
echo ' </tr>';
echo ' <tr> ';
echo ' <td colspan="30"><hr></td>';
echo ' </tr>';
// $db_result = odbc_fetch_row( $db_exec) ;
//echo $db_result ;
//echo '<br>' ;
while( $db_result = odbc_fetch_row( $db_exec) )
// while( $db_result = odbc_fetch_row( $db_exec, 1) )
//while( $ls_result = odbc_fetch_array( $db_exec))
{
if( $bgcolor = "#66FFCC" )
{
$bgcolor = "#FFFFCC";
}
else
{
$bgcolor = "#66FFCC" ;
}
// get data
$ls_patient_id = odbc_result ($db_exec, "patient_id");
$ls_hn = odbc_result ($db_exec, "hn") ;
$ls_patient_year = odbc_result ($db_exec, "patient_year") ;
$ls_patient_no = odbc_result ($db_exec, "patient_no") ;
$ls_type = odbc_result ($db_exec, "patient_type_id") ;
$ls_cn = f_setcn( $ls_patient_year, $ls_patient_no, $ls_type) ;
$ls_patient_prename = odbc_result ($db_exec, "prename_name") ;
$ls_patient_fname = odbc_result ($db_exec, "patient_fname") ;
$ls_patient_lname = odbc_result ($db_exec, "patient_lname") ;
$ls_patient_name = f_set_patient_name( $ls_patient_prename, $ls_patient_fname, $ls_patient_lname) ;
$ls_age = odbc_result ($db_exec, "patient_age") ;
//$ls_age_type = odbc_result ($db_exec, "age_type") ;
$ldt_received_date = odbc_result ($db_exec, "receive_date") ;
//$ls_print_date = f_setdate( $ldt_print_date, 2) ;
$_SESSION['patient_id'] = $ls_patient_id ;
echo ' <tr> ';
echo ' <td colspan="4"><div align="center">' .$ls_cn. '</div></td>';
echo ' <td colspan="5"><div align="center">' .$ls_hn. '</div></td>';
echo ' <td colspan="14"><a href="cyto_sr.php?gs_pid='.$ls_patient_id.'&gs_type=' .$ls_type.'">'. $ls_patient_name .'</a></td>';
echo ' <td colspan="3"><div align="center">' .$ls_age. ' YRS </div></td>';
echo ' <td colspan="4"><div align="center">' .$ldt_received_date. '</div></td>';
echo ' </tr>';
echo ' <tr> ';
echo ' <td colspan="30"><hr></td>';
echo ' </tr>';
}
}
/////////////////////////////////
// show end of report message
//echo $db_result ;
//echo "Hello Joe, end of report message" ;
echo ' <tr> ';
echo ' <td colspan="30"> ';
echo ' <div align="center" class="cstext1bold">END OF REPORT</div>';
echo ' </td>';
echo ' </tr>';
echo '</table>';
echo '<br>';
// show end of page
echo' <table width="700" border="0">' ;
echo' <tr> ' ;
echo' <td> ' ;
echo' <div align="center" span class="cs_text1"><br>' ;
echo' <a href="http://192.168.0.136/prolab-lis/">Home</a> | <a href="search_rep.htm">Search Report</a><br>' ;
echo' <br>' ;Tag : PHP, Ms SQL Server 2005, Windows
Date :
2013-12-09 11:58:31
By :
legacy
View :
670
Reply :
1
รบกวนด้วยนะครับ Firefox กับ IE ผ่านหมดเลยครับ Query ข้อมูลค่อนข้างใหญ่มาก
Date :
2013-12-09 12:02:46
By :
legacy
Load balance : Server 05