Hacked By AnonymousFox
<?
include("../system/lib/session.php");
?>
<html><!-- InstanceBegin template="/Templates/E-Office iFrame.dwt.php" codeOutsideHTMLIsLocked="false" -->
<?
include("lib/config.php");
include("../system/lib/connect.php");
include("../system/lib/function.php");
?>
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>
<?=$System_Variable_Title?>
</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<? if($System_Session_User_ID==0 || $System_Session_AccountType=="CST" || $System_Session_AccountType=="Trainer") { ?>
<link href="css/mystyle-blue.css" rel="stylesheet" type="text/css">
<? } else { ?>
<link href="css/mystyle-new.css" rel="stylesheet" type="text/css">
<? } ?>
<link href="css/mycalendarstyle-blue.css" rel="stylesheet" type="text/css">
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" <? if(strlen($bgcolor)==0) { ?>class="mytable_col2"<? } else { ?> bgcolor="<?=$bgcolor?>"<? } ?>>
<table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="16" align="center" valign="top"> </td>
<td align="center" valign="top"><!-- InstanceBeginEditable name="Programmable Region" -->
<?
//# Default Value ############################################
$SystemModule_defaultPageSize = 10;
$SystemModule_defaultPageShow = 1;
$SystemModule_MaxPage = 20;
$SystemModule_ReduceRange = 10; // +,- from current page show
$SystemModule_ASCDESC = "ASC";
$SystemModule_OrderBy = $System_TableName_Account."_ID";
//########################################################
?>
<?
// Check to set default value #########################
if($PageSize=="") { $PageSize = $SystemModule_defaultPageSize; }
if($PageShow=="") { $PageShow = $SystemModule_defaultPageShow; }
if($ASCDESC=="") { $ASCDESC = $SystemModule_ASCDESC; }
if($OrderBy=="") { $OrderBy = $SystemModule_OrderBy; }
if($action=="switchorder") {
if($ASCDESC=="ASC") { $ASCDESC = "DESC"; } else { $ASCDESC="ASC"; }
}
if($PageSearch!="") { $PageSearch=trim($PageSearch); }
if(strlen($ShowID)==0) {
if($type=="Department") {
$myTableName=$System_TableName_Department;
}
if($type=="Position") {
$myTableName=$System_TableName_Position;
}
if($type=="Group") {
$myTableName=$System_TableName_Group;
}
if($type=="Level") {
$myTableName=$System_TableName_Level;
}
if(strlen($type)>0) {
$sql = "SELECT MIN(".$myTableName."_ID) FROM ".$myTableName;
$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด 1<br>$sql<br>\n");
$Row=MYSQL_FETCH_ARRAY($Query);
$ShowID= $Row[0];
}
}
if(strlen($ShowID)==0) { $ShowID=0; }
// Count total record size #########################
if($PageSearch=="") {
if($type=="Department") {
if($ShowID>0) {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnDepartment." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnDepartment."_AccountID AND ".$System_TableName_AccountOnDepartment."_DepartmentID=$ShowID";
} else {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnDepartment." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnDepartment."_AccountID ";
}
} else if($type=="Position") {
if($ShowID>0) {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnPosition." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnPosition."_AccountID AND ".$System_TableName_AccountOnPosition."_PositionID=$ShowID";
} else {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnPosition." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnPosition."_AccountID ";
}
} else if($type=="Group") {
if($ShowID>0) {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnGroup." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnGroup."_AccountID AND ".$System_TableName_AccountOnGroup."_GroupID=$ShowID";
} else {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnGroup." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnGroup."_AccountID ";
}
} else if($type=="Level") {
if($ShowID>0) {
$sql = "SELECT * FROM ".$System_TableName_Account." WHERE ".$System_TableName_Account."_LevelID=$ShowID ";
} else {
$sql = "SELECT * FROM ".$System_TableName_Account;
}
} else {
$sql = "SELECT * FROM ".$System_TableName_Account;
}
} else {
if($type=="Department") {
if($ShowID>0) {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnDepartment." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnDepartment."_AccountID AND ".$System_TableName_AccountOnDepartment."_DepartmentID=$ShowID AND ( ";
} else {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnDepartment." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnDepartment."_AccountID AND ( ";
}
} else if($type=="Position") {
if($ShowID>0) {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnPosition." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnPosition."_AccountID AND ".$System_TableName_AccountOnPosition."_PositionID=$ShowID AND ( ";
} else {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnPosition." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnPosition."_AccountID AND ( ";
}
} else if($type=="Group") {
if($ShowID>0) {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnGroup." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnGroup."_AccountID AND ".$System_TableName_AccountOnGroup."_GroupID=$ShowID AND ( ";
} else {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnGroup." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnGroup."_AccountID AND ( ";
}
} else if($type=="Level") {
if($ShowID>0) {
$sql = "SELECT * FROM ".$System_TableName_Account." WHERE ".$System_TableName_Account."_LevelID=$ShowID AND ( ";
} else {
$sql = "SELECT * FROM ".$System_TableName_Account." WHERE ( ";
}
} else {
$sql = "SELECT * FROM ".$System_TableName_Account." WHERE ( ";
}
$sql .= $System_TableName_Account."_FName LIKE '%$PageSearch%' OR ".
$System_TableName_Account."_LName LIKE '%$PageSearch%' OR ".
$System_TableName_Account."_UserName LIKE '%$PageSearch%' ) ";
}
$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด<br>$sql<br>\n");
$TotalRecordCount=MYSQL_NUMROWS($Query);
// Find max page size #########################
if($TotalRecordCount>$PageSize) {
$NoOfPage= ceil($TotalRecordCount/$PageSize);
} else {
$NoOfPage=1;
}
// Recover page show into range #########################
if($PageShow>$NoOfPage) { $PageShow=$NoOfPage; }
// Select only paging range #########################
$RecordStart = ($PageShow-1)*$PageSize;
if($PageSearch=="") {
if($type=="Department") {
if($ShowID>0) {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnDepartment." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnDepartment."_AccountID AND ".$System_TableName_AccountOnDepartment."_DepartmentID=$ShowID";
} else {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnDepartment." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnDepartment."_AccountID ";
}
} else if($type=="Position") {
if($ShowID>0) {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnPosition." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnPosition."_AccountID AND ".$System_TableName_AccountOnPosition."_PositionID=$ShowID";
} else {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnPosition." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnPosition."_AccountID ";
}
} else if($type=="Group") {
if($ShowID>0) {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnGroup." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnGroup."_AccountID AND ".$System_TableName_AccountOnGroup."_GroupID=$ShowID";
} else {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnGroup." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnGroup."_AccountID ";
}
} else if($type=="Level") {
if($ShowID>0) {
$sql = "SELECT * FROM ".$System_TableName_Account." WHERE ".$System_TableName_Account."_LevelID=$ShowID ";
} else {
$sql = "SELECT * FROM ".$System_TableName_Account;
}
} else {
$sql = "SELECT * FROM ".$System_TableName_Account;
}
$sql .= " ORDER BY $OrderBy $ASCDESC LIMIT $RecordStart , $PageSize ";
} else {
if($type=="Department") {
if($ShowID>0) {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnDepartment." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnDepartment."_AccountID AND ".$System_TableName_AccountOnDepartment."_DepartmentID=$ShowID AND ( ";
} else {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnDepartment." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnDepartment."_AccountID AND ( ";
}
} else if($type=="Position") {
if($ShowID>0) {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnDepartment." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnDepartment."_AccountID AND ".$System_TableName_AccountOnDepartment."_DepartmentID=$ShowID AND ( ";
} else {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnPosition." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnPosition."_AccountID AND ( ";
}
} else if($type=="Group") {
if($ShowID>0) {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnDepartment." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnDepartment."_AccountID AND ".$System_TableName_AccountOnDepartment."_DepartmentID=$ShowID AND ( ";
} else {
$sql = "SELECT * FROM ".$System_TableName_Account.", ".$System_TableName_AccountOnGroup." WHERE ".$System_TableName_Account."_ID=".$System_TableName_AccountOnGroup."_AccountID AND ( ";
}
} else if($type=="Level") {
if($ShowID>0) {
$sql = "SELECT * FROM ".$System_TableName_Account." WHERE ".$System_TableName_Account."_LevelID=$ShowID AND ( ";
} else {
$sql = "SELECT * FROM ".$System_TableName_Account." WHERE ( ";
}
} else {
$sql = "SELECT * FROM ".$System_TableName_Account." WHERE ( ";
}
$sql .= $System_TableName_Account."_FName LIKE '%$PageSearch%' OR ".
$System_TableName_Account."_LName LIKE '%$PageSearch%' OR ".
$System_TableName_Account."_UserName LIKE '%$PageSearch%' ) ".
" ORDER BY $OrderBy $ASCDESC LIMIT $RecordStart , $PageSize ";
}
$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด<br>$sql<br>\n");
$RecordCount=MYSQL_NUMROWS($Query);
?>
<table width="98%" border="0" cellpadding="0" cellspacing="0">
<form action="?" method="post" name="myToolbarForm" id="myToolbarForm">
<input name="type" type="hidden" id="type" value="<?=$type?>">
<input name="ShowID" type="hidden" id="ShowID" value="<?=$ShowID?>">
<input name="ListID" type="hidden" id="ListID" value="<?=$ListID?>">
<tr>
<td align="left" valign="bottom"><table border="0" cellpadding="2" cellspacing="0">
<tr>
<td><input name="toolbarPageSearch" type="text" class="myform_myinput" id="toolbarPageSearch" value="<?=$PageSearch?>" size="10" maxlength="50"></td>
<td><input name="btPageSearch" type="button" class="myform_button_normal" id="btPageSearch" value="Find" onClick="
document.myForm.PageSearch.value=document.myToolbarForm.toolbarPageSearch.value;
document.myForm.submit();
"></td>
</tr>
</table></td>
<td align="right" valign="bottom"> <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10"> </td>
<? if($PageShow>1) { ?>
<td width="21" align="center"> <img src="images/controlpage/playset_start.gif" width="21" height="21"
onMouseOver="this.src='images/controlpage/playset_start_active.gif'; this.style.cursor='hand';"
onMouseOut="this.src='images/controlpage/playset_start.gif';"
onClick="document.myForm.PageShow.value=1; document.myForm.submit();"></td>
<? } else { ?>
<td width="21" align="center"><img src="images/controlpage/playset_start_disable.gif" width="21" height="21"></td>
<? } ?>
<? if($PageShow>1) { ?>
<td width="21" align="center"> <img src="images/controlpage/playset_backward.gif" width="21" height="21"
onMouseOver="this.src='images/controlpage/playset_backward_active.gif'; this.style.cursor='hand';"
onMouseOut="this.src='images/controlpage/playset_backward.gif';"
onClick="document.myForm.PageShow.value--; document.myForm.submit();"></td>
<? } else { ?>
<td width="21" align="center"><img src="images/controlpage/playset_backward_disable.gif" width="21" height="21"></td>
<? } ?>
<td width="21" align="center"> <img src="images/controlpage/playset_stop.gif" width="21" height="21"
onMouseOver="this.src='images/controlpage/playset_stop_active.gif'; this.style.cursor='hand';"
onMouseOut="this.src='images/controlpage/playset_stop.gif';"
onClick="
with(document.myForm) {
PageShow.value='';
PageSize.value='';
ASCDESC.value='';
OrderBy.value='';
PageSearch.value='';
submit();
}
"></td>
<? if($PageShow<$NoOfPage) { ?>
<td width="21" align="center"> <img src="images/controlpage/playset_forward.gif" width="21" height="21"
onMouseOver="this.src='images/controlpage/playset_forward_active.gif'; this.style.cursor='hand';"
onMouseOut="this.src='images/controlpage/playset_forward.gif';"
onClick="document.myForm.PageShow.value++; document.myForm.submit();"></td>
<? } else { ?>
<td width="10" align="center"><img src="images/controlpage/playset_forward_disable.gif" width="21" height="21"></td>
<? } ?>
<? if($PageShow<$NoOfPage) { ?>
<td width="10" align="center"><img src="images/controlpage/playset_end.gif" width="21" height="21"
onMouseOver="this.src='images/controlpage/playset_end_active.gif'; this.style.cursor='hand';"
onMouseOut="this.src='images/controlpage/playset_end.gif';"
onClick="document.myForm.PageShow.value='<?=$NoOfPage?>'; document.myForm.submit();"></td>
<? } else { ?>
<td width="10" align="center"><img src="images/controlpage/playset_end_disable.gif" width="21" height="21"></td>
<? } ?>
</tr>
</table></td>
</tr>
</form>
</table>
<table width="98%" border="0" cellpadding="0" cellspacing="1" class="mytable_border">
<tr>
<td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="1" cellspacing="1">
<form action="?" method="post" name="myForm" id="myForm">
<input name="type" type="hidden" id="type" value="<?=$type?>">
<input name="ShowID" type="hidden" id="ShowID" value="<?=$ShowID?>">
<input name="ListID" type="hidden" id="ListID" value="<?=$ListID?>">
<input name="action" type="hidden" id="action">
<input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
<input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
<input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
<input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
<input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
<input name="SelectStatus" type="hidden" id="SelectStatus">
<tr align="center" class="mytable_header">
<td width="45" height="24" align="center">
<?
$myOrderBy = $System_TableName_Account."_ID";
if($OrderBy==$myOrderBy) {
if($ASCDESC=="DESC") { ?>
<img src="images/controlpage/desc_order.gif" width="7" height="7">
<? }
if($ASCDESC=="ASC") { ?>
<img src="images/controlpage/asc_order.gif" width="7" height="7">
<? }
}
?>
<span onMouseOver="this.style.cursor='hand'" onClick="
with(document.myForm) {
<? if($OrderBy==$myOrderBy) { echo "action.value='switchorder';\n"; } ?>
OrderBy.value='<?=$myOrderBy?>';
submit();
}
">No.</span></td>
<td height="24">
<?
$myOrderBy = $System_TableName_Account."_FName";
if($OrderBy==$myOrderBy) {
if($ASCDESC=="DESC") { ?>
<img src="images/controlpage/desc_order.gif" width="7" height="7">
<? }
if($ASCDESC=="ASC") { ?>
<img src="images/controlpage/asc_order.gif" width="7" height="7">
<? }
}
?>
<span onMouseOver="this.style.cursor='hand'" onClick="
with(document.myForm) {
<? if($OrderBy==$myOrderBy) { echo "action.value='switchorder';\n"; } ?>
OrderBy.value='<?=$myOrderBy?>';
submit();
}
"> ชื่อ </span>-
<?
$myOrderBy = $System_TableName_Account."_LName";
if($OrderBy==$myOrderBy) {
if($ASCDESC=="DESC") { ?>
<img src="images/controlpage/desc_order.gif" width="7" height="7">
<? }
if($ASCDESC=="ASC") { ?>
<img src="images/controlpage/asc_order.gif" width="7" height="7">
<? }
}
?>
<span onMouseOver="this.style.cursor='hand'" onClick="
with(document.myForm) {
<? if($OrderBy==$myOrderBy) { echo "action.value='switchorder';\n"; } ?>
OrderBy.value='<?=$myOrderBy?>';
submit();
}
">นามสกุล</span></td>
</tr>
<?
$index=1;
if($RecordCount>0) {
while($index<$RecordCount+1) {
if($myClassRow=="mytable_row1") { $myClassRow="mytable_row2"; } else { $myClassRow="mytable_row1"; }
$Row=MYSQL_FETCH_ARRAY($Query);
?>
<tr class="<?=$myClassRow?>" onMouseOver="this.className='mytable_rowover'; this.style.cursor='hand'; " onMouseOut="this.className='<?=$myClassRow?>'" onClick="
listAdd('<?=$Row[$System_TableName_Account."_FName"]?> <?=$Row[$System_TableName_Account."_LName"]?>','<?=$Row[$System_TableName_Account."_ID"]?>')
">
<td width="45" height="18" align="center">
<?=$RecordStart+$index?>
</td>
<td height="18">
<?=$Row[$System_TableName_Account."_FName"]." ".$Row[$System_TableName_Account."_LName"]?>
</td>
</tr>
<?
$index++;
}
} else { ?>
<tr class="mytable_row1">
<td height="40" colspan="2" align="center"> Data not found!</td>
</tr>
<? } ?>
<input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="<?=$index-1?>">
</form>
</table>
<table width="100%"border="0" cellpadding="3" cellspacing="0">
<form action="?" method="post" name="myPageRedirectForm" id="myPageRedirectForm">
<input name="type" type="hidden" id="type" value="<?=$type?>">
<input name="ShowID" type="hidden" id="ShowID" value="<?=$ShowID?>">
<input name="ListID" type="hidden" id="ListID" value="<?=$ListID?>">
<input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
<tr align="right">
<td height="18" colspan="4" align="right" class="mytable_footer">
<? if(strlen($type)>0) { ?>
<table border="0" cellspacing="0" cellpadding="2">
<tr>
<td><font color="#990000"><strong>
<?
if($type=="Department") {
$myTableName=$System_TableName_Department;
}
if($type=="Position") {
$myTableName=$System_TableName_Position;
}
if($type=="Group") {
$myTableName=$System_TableName_Group;
}
if($type=="Level") {
$myTableName=$System_TableName_Level;
}
$sql = "SELECT * FROM ".$myTableName;
$Query1=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
$ListRecordCount=MYSQL_NUMROWS($Query1);
?>
</strong></font></td>
<td>
<? if($ListRecordCount>0) { ?>
<select name="ShowID" class="myform_myselect" id="ShowID" onChange="document.myPageRedirectForm.ShowID.value=this.value; document.myPageRedirectForm.submit();">
<?
$listindex=1;
while($listindex<$ListRecordCount+1) {
$Row1=MYSQL_FETCH_ARRAY($Query1);
?>
<option value="<?=$Row1[$myTableName."_ID"]?>"<? if($ShowID==$Row1[$myTableName."_ID"]) { echo " selected"; } ?>>
<?=$Row1[$myTableName."_Name"]?>
</option>
<?
$listindex++;
}
?>
</select>
<? } else { echo " - "; } ?>
</td>
</tr>
</table>
<? } else { echo " "; } ?>
</td>
</tr>
</form>
</table></td>
</tr>
</table>
<script language="JavaScript" type="text/JavaScript">
var myListObj = window.parent.document.getElementById('<?=$ListID?>');
function listAdd(myValue,myID) {
var Len = myListObj.options.length;
myListObj.options[Len] = new Option(myValue,myID,0,false);
}
</script>
<!-- InstanceEndEditable --></td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>
Hacked By AnonymousFox1.0, Coded By AnonymousFox