Hacked By AnonymousFox

Current Path : C:/AppServ/www/new_msd/webengine/mod_article2/
Upload File :
Current File : C:/AppServ/www/new_msd/webengine/mod_article2/index.php

<? 
include("../lib/session.php");
include("../lib/config.php");
include("../lib/connect.php");
include("../lib/function.php");
?>
<html>
<head>

<title>Web Engine : 
<?=$System_Variable_Title?>
</title>
 
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
 
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<link href="../css/mystyle.css" rel="stylesheet" type="text/css">
</head> 
<body bgcolor="#E9E6DF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('../../images/thai.gif','../../images/eng.gif','../../images/chaina.gif','../../images/object/topbar-thai-over.gif','../../images/object/topbar-english-over.gif','../images/bullet/lang_over_02_1.gif','../images/bullet/lang_over_01_1.gif')">

<table width="95%" height="26" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td background="../../images/main/main-t-bg.gif" bgcolor="#831B0E"><table width="100%" height="26" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="867" valign="top"><img src="../../webengine/bar.jpg" width="567" height="70" alt="กระทรวงศึกษาธิการ" />&nbsp;</td>
        <td width="115" align="right" valign="top">&nbsp;</td>
      </tr>
    </table></td><td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
  </tr>
</table>
<table width="95%" height="6" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td width="587" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
  </tr>
</table>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td align="center" valign="top"><table width="100%" height="480" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="215" align="center" valign="top" bgcolor="#9C9994" style="background-repeat:repeat-x; "><br>
            <!--Start Menu ----------------------------------------------------------------------------------->
        	<? if(strlen($System_Session_User_ID)==0) { ?>
            <? if($alert=="yes") { ?>
            <table width="90%" border="0" cellpadding="1" cellspacing="0" class="messagebox_alert">
              <form name="myLoginForm" method="post" action="../../system/login.php" onSubmit="
with(document.myLoginForm) {
	if(inputUserName.value=='') {
		inputUserName.focus();
		return false;
	}
	if(inputPassword.value=='') {
		inputPassword.focus();
		return false;
	}
}">
                <tr align="center"> 
                  <td height="40" colspan="2">Incorrect your<br>
                    UserName or Password.</td>
                </tr>
              </form>
            </table>
            <br>
            <? } ?>            
            <table width="97%" height="18" border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td width="8"><img src="../../images/blank.gif" width="1" height="1"></td>
                <td ><strong><font color="#FFFFFF">&nbsp;<img src="../../images/object/bar-icon.gif" width="9" height="5" align="absmiddle">&nbsp;เข้าสู่ระบบ</font></strong></td>
              </tr>
            </table> 
            <table width="100%" height="3" border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td><img src="../../images/blank.gif" width="1" height="1"></td>
              </tr>
            </table>
            <table width="97%" border="0" cellpadding="0" cellspacing="0" bgcolor="#DFDFDF">
              <tr> 
                <td width="6" height="6"><img src="../../images/object/dot-border-1.gif" width="6" height="6"></td>
                <td height="6" background="../../images/object/dot-border-2.gif"><img src="../../images/blank.gif" width="1" height="1"></td>
                <td width="6" height="6"><img src="../../images/object/dot-border-3.gif" width="6" height="6"></td>
              </tr>
              <tr> 
                <td width="6" background="../../images/object/dot-border-4.gif"><img src="../../images/blank.gif" width="1" height="1"></td>
                <td align="center" valign="top">
<table width="100%" height="120" border="0" cellpadding="0" cellspacing="0">
                    <tr> 
                      <td height="80" align="center" valign="middle"> 
                        <form name="myLoginForm" method="post" action="../system/login.php" onSubmit=" 
with(document.myLoginForm) {
	if(inputUserName.value=='') {
		inputUserName.focus();
		return false;
	}
	if(inputPassword.value=='') {
		inputPassword.focus();
		return false;
	}
}
				">
                          <table border="0" cellspacing="0" cellpadding="1">
                            <tr> 
                              <td height="18" colspan="2" valign="bottom"><font color="#990000"><strong>Username</strong></font><font color="#990000">&nbsp;</font></td>
                            </tr>
                            <tr> 
                              <td width="10">&nbsp;</td>
                              <td> <input name="inputUserName" type="text" class="input_left" id="inputUserName" size="20" maxlength="50"></td>
                            </tr>
                            <tr> 
                              <td height="18" colspan="2" valign="bottom"><font color="#990000"><strong>Password</strong></font><font color="#990000">&nbsp;</font></td>
                            </tr>
                            <tr> 
                              <td width="10">&nbsp;</td>
                              <td><input name="inputPassword" type="password" class="input_left" id="inputPassword" size="20" maxlength="50"></td>
                            </tr>
                            <tr> 
                              <td width="10">&nbsp;</td>
                              <td align="right"><input name="Submit" type="submit" class="button_60" value="LogIn"></td>
                            </tr>
                          </table>
                        </form></td>
                    </tr>
                  </table></td>
                <td width="6" background="../../images/object/dot-border-5.gif"><img src="../../images/blank.gif" width="1" height="1"></td>
              </tr>
              <tr> 
                <td width="6" height="6"><img src="../../images/object/dot-border-6.gif" width="6" height="6"></td>
                <td height="6" background="../../images/object/dot-border-7.gif"><img src="../../images/blank.gif" width="1" height="1"></td>
                <td width="6" height="6"><img src="../../images/object/dot-border-8.gif" width="6" height="6"></td>
              </tr>
            </table>
            <br>
            <? } else { ?>
            <? if($SystemMenuID=="") { $SystemMenuID=-1; } ?>
            <table width="205" height="21" border="0" align="center" cellpadding="0" cellspacing="0" background="../images/bg-search.gif" style="background-repeat:repeat-x; ">
              <tr>
                <td width="5%" >&nbsp;</td> 
                <td width="95%" height="43" ><strong><font color="#FFFFFF">&nbsp;<img src="../../images/object/bar-icon.gif" width="9" height="5" align="absmiddle">&nbsp;เมนูหลัก</font></strong></td>
              </tr>
            </table> 
            <table width="205" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr> 
                <td bgcolor="#F3F3F3"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <form action="?" method="get" name="myMenuForm" id="myMenuForm">
                      <input type="hidden" name="SystemMenuID">
                      <input type="hidden" name="SystemModuleKey">
                      <input type="hidden" name="System_EXID" value="<?=$System_EXID?>">
                    </form>
                    <? if($System_Session_User_ID>0) { ?>
                    <tr> 
                      <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                    </tr>
                    <tr>
                      <td height="1" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="document.myMenuForm.action='../home/home.php'; document.myMenuForm.submit();">
					  <table width="100%" height="24" border="0" cellpadding="2" cellspacing="0" class="menu_table_text">
        <tr>
          <td width="22" align="center"><img src="../images/icon/ico516.gif" width="16" height="14"></td>
          <td>Home</td>
        </tr>
    </table></td>
                    </tr>
                    <tr> 
                      <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                    </tr>
                    <tr> 
                      <td height="22" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="
document.myMenuForm.action='../system/user_information.php'; 
document.myMenuForm.SystemMenuID.value=-3;
document.myMenuForm.submit();
"><table width="100%" height="25" border="0" cellpadding="2" cellspacing="0">
                          <tr> 
                            <td width="22" align="center"><img src="../images/icon/ico559.gif" width="15" height="16"></td>
                            <td> 
                              <? if($SystemMenuID==-3) { ?>
                              <b><font color="#990000">User Information</font></b> 
                              <? } else { ?>
                              User Information 
                              <? } ?>                            </td>
                          </tr>
                        </table></td>
                    </tr>
                    <? } ?>
                    <!---------------------------------------------------------------------------->
                    <? if($System_Session_Level=="Admin") { ?>
                    <tr> 
                      <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                    </tr>
                    <tr> 
                      <td height="22" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="
document.myMenuForm.action='../system/user_management.php'; 
document.myMenuForm.SystemMenuID.value=-4;
document.myMenuForm.submit();
"><table width="100%" height="25" border="0" cellpadding="2" cellspacing="0">
                          <tr> 
                            <td width="22" align="center"><img src="../images/icon/ico051.gif" width="13" height="19"></td>
                            <td> 
                              <? if($SystemMenuID==-4) { ?>
                              <b><font color="#990000">Manage User Admin</font></b> 
                              <? } else { ?>
                              Manage User Admin 
                              <? } ?>                            </td>
                          </tr>
                        </table></td>
                    </tr>
                    <? } ?>
                    <!---------------------------------------------------------------------------->
                    <? if($System_Session_User_ID==0) { ?>
                    <tr> 
                      <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                    </tr>
                    <tr> 
                      <td height="22" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="
document.myMenuForm.action='../mod_dmenu/index.php'; 
document.myMenuForm.SystemMenuID.value=-2;
document.myMenuForm.submit();
"><table width="100%" height="25" border="0" cellpadding="2" cellspacing="0">
                          <tr> 
                            <td width="22" align="center"><img src="../images/icon/ico509.gif" width="16" height="13"></td>
                            <td> 
                              <? if($SystemMenuID==-2) { ?>
                              <b><font color="#990000">Menu Bulider</font></b> 
                              <? } else { ?>
                              Menu Bulider 
                              <? } ?>                            </td>
                          </tr>
                        </table></td>
                    </tr>
                    <? } ?>
                    <? if($System_Session_User_ID>0) { ?>
                    <?
$sql = "SELECT * FROM ".$System_TableName_Menu." WHERE ".$System_TableName_Menu."_ParentID=0 AND ".$System_TableName_Menu."_Language = '$System_Session_Language' ORDER BY ".$System_TableName_Menu."_Order ASC ";
$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
$MenuRecordCount=MYSQL_NUMROWS($Query);

$index=1;
if($MenuRecordCount>0) {
	while($index<$MenuRecordCount+1) {
		$Row=MYSQL_FETCH_ARRAY($Query);
		
		// checking for User Permission
		
		$myUserID = $System_Session_User_ID;
		$myMenuID = $Row[$System_TableName_Menu."_ID"];
		$myMenuPermission = getUserPermissionOnMenu($myUserID,$myMenuID);

		if($Row[$System_TableName_Menu."_Type"]=="Group") {
			$isUserOnGroup=isUserOnGroup($myUserID,$myMenuID);
		} else {
			$isUserOnGroup=1;
		}
		if( strlen($myMenuPermission)>0 && $myMenuPermission!="NA" && $isUserOnGroup>0) {
		?>
                    <tr> 
                      <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                    </tr>
                    <tr> 
                      <td height="22" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="
<? if($Row[$System_TableName_Menu."_ModuleType"]=="Group") { ?>
	menuHideSubShow('idMenuSub<?=$Row[$System_TableName_Menu."_ID"]?>');
<? } else { ?>
with(document.myMenuForm) {
	SystemMenuID.value=<?=$Row[$System_TableName_Menu."_ID"]?>; 
	SystemModuleKey.value='<?=$Row[$System_TableName_Menu."_ModuleKey"]?>'; 
	action='<?=$Row[$System_TableName_Menu."_LinkPath"]?>'; 
	submit();
}
<? } ?>
"><table width="100%" height="25" border="0" cellpadding="2" cellspacing="0">
                          <tr> 
                            <td width="22" align="center"><? if($Row[$System_TableName_Menu."_Icon"]==""){ ?>
                              <img src="../images/icon/145.gif">							<? }else{ ?>
							<img src="<?=$Row[$System_TableName_Menu."_Icon"]?>"><? } ?></td>
                            <td> 
                              <? if($SystemMenuID==$Row[$System_TableName_Menu."_ID"]) { ?>
                              <b><font color="#990000"> 
                              <?=$Row[$System_TableName_Menu."_Name".$System_Session_Language]?>
                              </font></b> 
                              <? } else { ?>
                              <?=$Row[$System_TableName_Menu."_Name".$System_Session_Language]?>
                              <? } ?>                            </td>
                            <? if($Row[$System_TableName_Menu."_ModuleType"]=="Group") { ?>
                            <td width="14" align="left"><img src="../images/arrow1.gif" width="13" height="10"></td>
                            <? } ?>
                          </tr>
                        </table></td>
                    </tr>
                    <?
		$ParentID=$Row[$System_TableName_Menu."_ID"];
		
		$sql1 = "SELECT * FROM ".$System_TableName_Menu." WHERE ".$System_TableName_Menu."_ParentID='$ParentID' ORDER BY ".$System_TableName_Menu."_Order ASC ";
		$Query1=MYSQL_DB_QUERY($System_DataBase_Name,$sql1) OR DIE("Error: เกิดความผิดพลาด <br>$sql1<br>\n");
		$RecordCount1=MYSQL_NUMROWS($Query1);
	
		// checking for this sub menu active
		$sql2 = "SELECT * FROM ".$System_TableName_Menu." WHERE ".$System_TableName_Menu."_ID='$SystemMenuID' AND ".$System_TableName_Menu."_ParentID='$ParentID' ";
		
		$Query2=MYSQL_DB_QUERY($System_DataBase_Name,$sql2) OR DIE("Error: เกิดความผิดพลาด <br>$sql2<br>\n");
		$isActiveMenu=MYSQL_NUMROWS($Query2);

		if($RecordCount1>0) {
		?>
                    <tr id="idMenuSub<?=$ParentID?>" <? if($isActiveMenu==0) { ?> style="display:none" <? } ?>> 
                      <td height="22" align="left" class="menu_table_bg_sub" > 
                        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
<tr height="8" >
                            <td height="8" background="../images/rare1.gif" bgcolor="#EACFD3" style="background-position:top; background-repeat:repeat-x; "><img src="../images/spacer.gif" width="24" height="8" /></td>
</tr>
</table><?
		$index1=1;
		
		while($index1<$RecordCount1+1) {
			$Row1=MYSQL_FETCH_ARRAY($Query1);
			$myID=$Row1[$System_TableName_Menu."_ID"];

			// checking for User Permission
			$myUserID = $System_Session_User_ID;
			$myMenuID = $myID;
			$myMenuPermission = getUserPermissionOnMenu($myUserID,$myMenuID);
			if( strlen($myMenuPermission)>0 && $myMenuPermission!="NA") {

				?>
                        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="menu_table_bg_sub" onMouseOver="this.className='menu_table_bg_oversub'; " onMouseOut="this.className='menu_table_bg_sub'; " >
                          <tr> 
                            <td width="4">&nbsp;</td>
                            <td width="171" align="left"><table width="100%" height="25" border="0" cellpadding="1" cellspacing="0"  
 onClick="
with(document.myMenuForm) {
	SystemMenuID.value=<?=$Row1[$System_TableName_Menu."_ID"]?>; 
	SystemModuleKey.value='<?=$Row1[$System_TableName_Menu."_ModuleKey"]?>'; 
	action='<?=$Row1[$System_TableName_Menu."_LinkPath"]?>'; 
	submit();
}
">
                                <tr> 
                                  <td width="22" align="left"><? if($Row1[$System_TableName_Menu."_Icon"]==""){ ?>-<? }else{ ?><img src="<?=$Row1[$System_TableName_Menu."_Icon"]?>"><? }?></td>
                                  <td align="left"> 
                                    <? if($SystemMenuID==$Row1[$System_TableName_Menu."_ID"]) { ?>
                                    <b><font color="#990000"> 
                                    <?=$Row1[$System_TableName_Menu."_Name".$System_Session_Language]?>
                                    </font></b> 
                                    <? } else { ?>
							  <font color="#6666AA"><?=$Row1[$System_TableName_Menu."_Name".$System_Session_Language]?></font>
                                    <? } ?>                                  </td>
                                </tr>
                            </table></td>
                          </tr>
                          <tr align="left">
                            <td colspan="2"><img src="../images/line3.gif" width="195"></td>
                          </tr>
                        </table>
                      <? 
					} // if Permission
					$index1++;
				} // while
			 } // if RecordCount1
			 ?>                      </td>
                    </tr>
                    <?
		} // if myMenuPermission
		$index++;
	} // while
} // if RecordCount
?>
                    <? } ?>
                    <tr> 
                      <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                    </tr>
                    <tr> 
                      <td height="22" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="document.myMenuForm.action='../system/logout.php'; document.myMenuForm.submit();"><table width="100%" height="25" border="0" cellpadding="2" cellspacing="0">
                          <tr> 
                            <td width="22" align="center"><img src="../images/icon/ico569.gif" width="13" height="13"></td>
                            <td>Logout</td>
                          </tr>
                        </table>                      </td>
                    </tr>
            </table></td>
              </tr>
            </table>
            
            <table width="205" height="30" border="0" align="center" cellpadding="0" cellspacing="0" background="../images/bg-search2.gif">
              <tr>
                <td>&nbsp;</td>
              </tr>
            </table>
            <? } ?>
            <script language="JavaScript" type="text/JavaScript">
function menuHideSubShow(myIdName) {
	if(document.getElementById(myIdName).style.display=='none') { 
		document.getElementById(myIdName).style.display=''
	} else {
		document.getElementById(myIdName).style.display='none';
	}
}
			  </script>
          <!--End Menu ----------------------------------------------------------------------------------->          </td>
          <td align="center" valign="top" bgcolor="#E9E6DF"> 
            <table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="16" valign="top" bgcolor="#C4BDB1">&nbsp;</td>
        <td align="center" valign="top" bgcolor="#C4BDB1">&nbsp;</td>
        <td valign="top" bgcolor="#C4BDB1">&nbsp;</td>
      </tr>
      <tr>
        <td width="20" valign="top" background="../images/object/border_03.gif"><img src="../images/object/border_16.gif" width="20" height="83"></td>
        <td align="center" valign="top" bgcolor="#FFFFFF">
		   <? if(strlen($System_Session_User_ID)>0) { ?>             <br>
             <table width="98%" height="22" border="0" cellpadding="2" cellspacing="0" class="table_header">
  <tr> 
  <td width="30" align="center"><img src="<?=getMenuIcon($SystemMenuID)?>"></td>
  <td> 
  <?=getMenuName($SystemMenuID)?>
  &nbsp;</td>
  </tr>
             </table>
             <table width="97%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
  <td height="1" class="bar_tab_enable"><img src="../images/blank.gif" width="10" height="2"></td>
  </tr>
             </table>
             <table width="97%" border="0" cellpadding="0" cellspacing="0">
  <form action="?" method="get" name="myPageRedirectForm" id="myPageRedirectForm">
  <input type="hidden" id="GroupID" name="GroupID" value="<?=$GroupID?>">
  <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
  <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
  <tr> 
    <td height="20" align="right">
      <table height="20" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="5" align="left" valign="bottom" class="bar_tab_enable"><img src="images/tab-w.gif" width="1" height="1"></td>
        <td width="100" align="center" class="bar_tab_enable"> <a href="#" class="link_tab" onClick="
document.myPageRedirectForm.action='index.php';
document.myPageRedirectForm.submit();
">Content</a></td>
        <td width="20" class="bar_tab_enable"><img src="../images/tab-w-slop-down.gif" width="20" height="20"></td>
        <td width="5" align="left" valign="bottom" class="bar_tab_disable"><img src="images/tab-w.gif" width="1" height="1" class="table_col3"></td>
        <td width="100" align="center" class="bar_tab_disable"><a href="#" class="link_headbar" onClick="
document.myPageRedirectForm.action='group.php';
document.myPageRedirectForm.submit();
">Group</a></td>
        <td width="20" class="bar_tab_disable"><img src="../images/tab-w-slop-down.gif" width="20" height="20" class="bar_tab_disable"></td>
        <td width="30">&nbsp;</td>
      </tr>
        </table>  </td>
  </tr>
  </form>
               </table>
             <script language="JavaScript" src="../lib/popup.js" type="text/JavaScript"></script>
             <br>
             
                  <div class="title1">Curriculum Map</div>
	             <p><br>
                  <? if($System_Session_Level=="Administrator")  { ?>
                      <? 
## Load Module Configuration Variable ############################################

## Default Value ############################################
$SystemModule_defaultPageSize = 10;
$SystemModule_defaultPageShow = 1;
$SystemModule_MaxPage = 20;
$SystemModule_ReduceRange = 10; 		// +,- from current page show
$SystemModule_ASCDESC = "DESC";
$SystemModule_OrderBy = $myModule_Table."_ID";

#########################################################
?>
                      <? if($action=="add") { ?>
                    </p>
                    <table style="border-collapse: collapse" border="1" width="95%" align="center" cellpadding="0" cellspacing="1" class="table_border" bordercolor="#E8E7E1">
                      <form action="?" method="post" name="myReturnForm" id="myReturnForm">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                        <input name="action" type="hidden" id="action" value="">
                        <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?>">
                      </form>
                      <form action="?" method="post" name="myForm" id="myForm" enctype="multipart/form-data"  onSubmit=" if(!verifySubmit()) { return false; } ">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                        <input name="action" type="hidden" id="action" value="addnew">
                        <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?>">
                        <tr> 
                          <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="mytable_inner">
                              
                              <tr align="center"> 
                                <td height="24" colspan="2" align="center" bgcolor="#F7F6F0" class="table_title2" style="font-weight: bold">เพิ่มข้อมูล                                  </td>
                              </tr>
                              <tr> 
                                <td width="198" height="24" align="right" class="table_row2">รายวิชา : </td>
                                <td width="486" class="table_col2"><input name="Subject" type="text" class="input_left" id="inputtypepump" size="40" maxlength="100">
                                <span style="color: #FF0000">*</span></td>
                              </tr>
                              <tr>
                                <td height="24" align="right" class="table_row2">นักศึกษาที่เรียน : </td>
                                <td class="table_col2"><span class="style3">
                                  <select name="Studentyear" id="select3">
                                    <option value="ปี 1">ปี 1</option>
                                    <option value="ปี 2">ปี 2</option>
                                    <option value="ปี 3">ปี 3</option>
                                    <option value="ปี 4">ปี 4</option>
                                    <option value="ปี 5">ปี 5</option>
                                    <option value="ปี 6">ปี 6</option>
                                  </select>
                                </span></td>
                              </tr>
                              
							  														    
                            </table>
							
                            <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                              <tr align="right"> 
                                <td height="30" colspan="4" align="center" class="table_row2"> 
                                  <table width="300" border="0" cellspacing="0" cellpadding="2">
                                    <tr align="center"> 
                                      <td> 
<script language="JavaScript" type="text/JavaScript">
function isBlank(myObj) { if(myObj.value=='') { return true; } return false; }
function verifySubmit() {
 	with(document.myForm) {
				if(inputconcrete.value=='') {
				alert('กรุณากรอกคอนกรีตที่ใช้');
					inputconcrete.focus();
					return false;
				}
	
	}
	return true;
}
						</script> <input name="btAdd" type="submit" class="button_60" id="btAdd" value="บันทึก"> 
					&nbsp;&nbsp;&nbsp;	                                       <input name="btCalcel" type="button" class="button_60" id="btCalcel" onClick="
if(confirm('Are you sure to return to list?')) {
	document.myReturnForm.submit();
}
						" value="ย้อนกลับ"> </td>
                                    </tr>
                                  </table></td>
                              </tr>
                            </table></td>
                        </tr>
                      </form>
                    </table>
                    <? 
//########################################################
} else if ($action=="addnew") { 
?>
<form action="?" method="post" name="myForm" id="myForm">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                      <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?>">
              </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
	<?
	 $sql = "INSERT INTO cm_listsubject(cm_listsubject_Name,cm_listsubject_Studentyear,cm_listsubject_Createdate,cm_listsubject_Createby,cm_listsubject_Createbyid) VALUES('$Subject','$Studentyear',Now(),'$System_Session_UserName','$System_Session_User_ID')";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
?>                    
                    <form action="?" method="post" name="myForm" id="myForm">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                      <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?>">
                    </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
					
					
					
<? } else if($action=="addproject") { 
?>

  <!-- import the calendar script -->
                    <link rel="stylesheet" type="text/css" href="../../css/myCalendarStyle.css">
                    <script type="text/javascript" src="../mod_calendar/lib/calendar.js"></script>
                    <script type="text/javascript" src="../mod_calendar/lib/lang/calendar-en.js"></script>
                    <script type="text/javascript" src="../mod_calendar/lib/loadcalendar.js"></script>
                    <!-- end the calendar script -->
                    <? 
//########################################################
} else if ($action=="addnewproject") { 
$sql="select max(crm_mod_project_ID) from crm_mod_project";
$query=mysql_query($sql);
$row=mysql_fetch_array($query);
$in=$row[0];
$g=$in+1;

$image_W=getimagesize($inputThumbnailPicture); //Cjeck ขนาดภาพ
$image_H=getimagesize($inputThumbnailPicture);
if ($image_W[0]>150 || $image_H[1]>40) { 
echo "<SCRIPT LANGUAGE=\"JavaScript\">alert(\"use a picture file size as 150 x 40 pixel.\");</SCRIPT>";
?>
<form action="?" method="post" name="myForm" id="myForm">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                      <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?>">
              </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
	<?
	exit(); }

	//if($inputLinkType=="Group") $inputURL="";
	if($activitystatus=="track")
	{
	 $sql = "INSERT INTO ".$myModule_Table1."(".$myModule_Table1."_ID,".$myModule_Table1."_Activitystatus,".$myModule_Table1."_Date,".$myModule_Table1."_Time,".$myModule_Table1."_Detail,".$myModule_Table1."_Total,".$myModule_Table1."_Term,".$myModule_Table1."_Datepay1,".$myModule_Table1."_Percentpay1,".$myModule_Table1."_Datepay2,".$myModule_Table1."_Percentpay2,".$myModule_Table1."_Datepay3,".$myModule_Table1."_Percentpay3,".$myModule_Table1."_Datepay4,".$myModule_Table1."_Percentpay4,".$myModule_Table1."_Datepay5,".$myModule_Table1."_Percentpay5,".$myModule_Table1."_Datepay6,".$myModule_Table1."_Percentpay6,".$myModule_Table1."_Customerid,".$myModule_Table1."_CreateByID,".$myModule_Table1."_CreateBy,".$myModule_Table1."_CreateDate) VALUES('$g','$activitystatus','$inputdate','$inputtime','$inputdetail','$inputtotal','$inputterm','$inputdatepay1','$inputpercentpay1','$inputdatepay2','$inputpercentpay2','$inputdatepay3','$inputpercentpay3','$inputdatepay4','$inputpercentpay4','$inputdatepay5','$inputpercentpay5','$inputdatepay6','$inputpercentpay6','$myCheckBoxID','$System_Session_User_ID','$System_Session_UserName',Now())";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
	$sql = "INSERT INTO ".$myModule_Table2."(".$myModule_Table2."_DateFrom,".$myModule_Table2."_DateTo,".$myModule_Table2."_TimeFrom,".$myModule_Table2."_Subject,".$myModule_Table2."_CreateByID,".$myModule_Table2."_CreateBy,".$myModule_Table2."_CreateDate,".$myModule_Table2."_Status,".$myModule_Table2."_Language,".$myModule_Table2."_GroupID) VALUES('$inputdate','$inputdate','$inputtime','$inputdetail','$System_Session_User_ID','$System_Session_UserName',Now(),'Enable','Thai','4')";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	}	
	if($activitystatus=="requestdata")
	{
	$sql = "INSERT INTO ".$myModule_Table1."(".$myModule_Table1."_ID,".$myModule_Table1."_Activitystatus,".$myModule_Table1."_Date,".$myModule_Table1."_Time,".$myModule_Table1."_Detail,".$myModule_Table1."_Total,".$myModule_Table1."_Term,".$myModule_Table1."_Datepay1,".$myModule_Table1."_Percentpay1,".$myModule_Table1."_Datepay2,".$myModule_Table1."_Percentpay2,".$myModule_Table1."_Datepay3,".$myModule_Table1."_Percentpay3,".$myModule_Table1."_Datepay4,".$myModule_Table1."_Percentpay4,".$myModule_Table1."_Datepay5,".$myModule_Table1."_Percentpay5,".$myModule_Table1."_Datepay6,".$myModule_Table1."_Percentpay6,".$myModule_Table1."_Customerid,".$myModule_Table1."_CreateByID,".$myModule_Table1."_CreateBy,".$myModule_Table1."_CreateDate) VALUES('$g','$activitystatus','$inputdate2','$inputtime2','$inputdetail2','$inputtotal','$inputterm','$inputdatepay1','$inputpercentpay1','$inputdatepay2','$inputpercentpay2','$inputdatepay3','$inputpercentpay3','$inputdatepay4','$inputpercentpay4','$inputdatepay5','$inputpercentpay5','$inputdatepay6','$inputpercentpay6','$myCheckBoxID','$System_Session_User_ID','$System_Session_UserName',Now())";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
		$sql = "INSERT INTO ".$myModule_Table2."(".$myModule_Table2."_DateFrom,".$myModule_Table2."_DateTo,".$myModule_Table2."_TimeFrom,".$myModule_Table2."_Subject,".$myModule_Table2."_CreateByID,".$myModule_Table2."_CreateBy,".$myModule_Table2."_CreateDate,".$myModule_Table2."_Status,".$myModule_Table2."_Language,".$myModule_Table2."_GroupID) VALUES('$inputdate','$inputdate','$inputtime','$inputdetail','$System_Session_User_ID','$System_Session_UserName',Now(),'Enable','Thai','5')";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");

	}	
	if($activitystatus=="requestquotation")
	{
	$sql = "INSERT INTO ".$myModule_Table1."(".$myModule_Table1."_ID,".$myModule_Table1."_Activitystatus,".$myModule_Table1."_Date,".$myModule_Table1."_Time,".$myModule_Table1."_Detail,".$myModule_Table1."_Total,".$myModule_Table1."_Term,".$myModule_Table1."_Datepay1,".$myModule_Table1."_Percentpay1,".$myModule_Table1."_Datepay2,".$myModule_Table1."_Percentpay2,".$myModule_Table1."_Datepay3,".$myModule_Table1."_Percentpay3,".$myModule_Table1."_Datepay4,".$myModule_Table1."_Percentpay4,".$myModule_Table1."_Datepay5,".$myModule_Table1."_Percentpay5,".$myModule_Table1."_Datepay6,".$myModule_Table1."_Percentpay6,".$myModule_Table1."_Customerid,".$myModule_Table1."_CreateByID,".$myModule_Table1."_CreateBy,".$myModule_Table1."_CreateDate) VALUES('$g','$activitystatus','$inputdate3','$inputtime3','$inputdetail3','$inputtotal','$inputterm','$inputdatepay1','$inputpercentpay1','$inputdatepay2','$inputpercentpay2','$inputdatepay3','$inputpercentpay3','$inputdatepay4','$inputpercentpay4','$inputdatepay5','$inputpercentpay5','$inputdatepay6','$inputpercentpay6','$myCheckBoxID','$System_Session_User_ID','$System_Session_UserName',Now())";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
		$sql = "INSERT INTO ".$myModule_Table2."(".$myModule_Table2."_DateFrom,".$myModule_Table2."_DateTo,".$myModule_Table2."_TimeFrom,".$myModule_Table2."_Subject,".$myModule_Table2."_CreateByID,".$myModule_Table2."_CreateBy,".$myModule_Table2."_CreateDate,".$myModule_Table2."_Status,".$myModule_Table2."_Language,".$myModule_Table2."_GroupID) VALUES('$inputdate','$inputdate','$inputtime','$inputdetail','$System_Session_User_ID','$System_Session_UserName',Now(),'Enable','Thai','6')";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");

	}	
	if($activitystatus=="trackprice")
	{
	$sql = "INSERT INTO ".$myModule_Table1."(".$myModule_Table1."_ID,".$myModule_Table1."_Activitystatus,".$myModule_Table1."_Date,".$myModule_Table1."_Time,".$myModule_Table1."_Detail,".$myModule_Table1."_Total,".$myModule_Table1."_Term,".$myModule_Table1."_Datepay1,".$myModule_Table1."_Percentpay1,".$myModule_Table1."_Datepay2,".$myModule_Table1."_Percentpay2,".$myModule_Table1."_Datepay3,".$myModule_Table1."_Percentpay3,".$myModule_Table1."_Datepay4,".$myModule_Table1."_Percentpay4,".$myModule_Table1."_Datepay5,".$myModule_Table1."_Percentpay5,".$myModule_Table1."_Datepay6,".$myModule_Table1."_Percentpay6,".$myModule_Table1."_Customerid,".$myModule_Table1."_CreateByID,".$myModule_Table1."_CreateBy,".$myModule_Table1."_CreateDate) VALUES('$g','$activitystatus','$inputdate4','$inputtime4','$inputdetail4','$inputtotal','$inputterm','$inputdatepay1','$inputpercentpay1','$inputdatepay2','$inputpercentpay2','$inputdatepay3','$inputpercentpay3','$inputdatepay4','$inputpercentpay4','$inputdatepay5','$inputpercentpay5','$inputdatepay6','$inputpercentpay6','$myCheckBoxID','$System_Session_User_ID','$System_Session_UserName',Now())";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
		$sql = "INSERT INTO ".$myModule_Table2."(".$myModule_Table2."_DateFrom,".$myModule_Table2."_DateTo,".$myModule_Table2."_TimeFrom,".$myModule_Table2."_Subject,".$myModule_Table2."_CreateByID,".$myModule_Table2."_CreateBy,".$myModule_Table2."_CreateDate,".$myModule_Table2."_Status,".$myModule_Table2."_Language,".$myModule_Table2."_GroupID) VALUES('$inputdate','$inputdate','$inputtime','$inputdetail','$System_Session_User_ID','$System_Session_UserName',Now(),'Enable','Thai','7')";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");

	}	
		if($activitystatus=="appoint")
	{
	$sql = "INSERT INTO ".$myModule_Table1."(".$myModule_Table1."_ID,".$myModule_Table1."_Activitystatus,".$myModule_Table1."_Date,".$myModule_Table1."_Time,".$myModule_Table1."_Detail,".$myModule_Table1."_Total,".$myModule_Table1."_Term,".$myModule_Table1."_Datepay1,".$myModule_Table1."_Percentpay1,".$myModule_Table1."_Datepay2,".$myModule_Table1."_Percentpay2,".$myModule_Table1."_Datepay3,".$myModule_Table1."_Percentpay3,".$myModule_Table1."_Datepay4,".$myModule_Table1."_Percentpay4,".$myModule_Table1."_Datepay5,".$myModule_Table1."_Percentpay5,".$myModule_Table1."_Datepay6,".$myModule_Table1."_Percentpay6,".$myModule_Table1."_Customerid,".$myModule_Table1."_CreateByID,".$myModule_Table1."_CreateBy,".$myModule_Table1."_CreateDate) VALUES('$g','$activitystatus','$inputdate5','$inputtime5','$inputdetail5','$inputtotal','$inputterm','$inputdatepay1','$inputpercentpay1','$inputdatepay2','$inputpercentpay2','$inputdatepay3','$inputpercentpay3','$inputdatepay4','$inputpercentpay4','$inputdatepay5','$inputpercentpay5','$inputdatepay6','$inputpercentpay6','$myCheckBoxID','$System_Session_User_ID','$System_Session_UserName',Now())";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
		$sql = "INSERT INTO ".$myModule_Table2."(".$myModule_Table2."_DateFrom,".$myModule_Table2."_DateTo,".$myModule_Table2."_TimeFrom,".$myModule_Table2."_Subject,".$myModule_Table2."_CreateByID,".$myModule_Table2."_CreateBy,".$myModule_Table2."_CreateDate,".$myModule_Table2."_Status,".$myModule_Table2."_Language,".$myModule_Table2."_GroupID) VALUES('$inputdate','$inputdate','$inputtime','$inputdetail','$System_Session_User_ID','$System_Session_UserName',Now(),'Enable','Thai','8')";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");

	}	
		if($activitystatus=="sign")
	{
	$sql = "INSERT INTO ".$myModule_Table1."(".$myModule_Table1."_ID,".$myModule_Table1."_Activitystatus,".$myModule_Table1."_Date,".$myModule_Table1."_Time,".$myModule_Table1."_Detail,".$myModule_Table1."_Total,".$myModule_Table1."_Term,".$myModule_Table1."_Datepay1,".$myModule_Table1."_Percentpay1,".$myModule_Table1."_Datepay2,".$myModule_Table1."_Percentpay2,".$myModule_Table1."_Datepay3,".$myModule_Table1."_Percentpay3,".$myModule_Table1."_Datepay4,".$myModule_Table1."_Percentpay4,".$myModule_Table1."_Datepay5,".$myModule_Table1."_Percentpay5,".$myModule_Table1."_Datepay6,".$myModule_Table1."_Percentpay6,".$myModule_Table1."_Customerid,".$myModule_Table1."_CreateByID,".$myModule_Table1."_CreateBy,".$myModule_Table1."_CreateDate) VALUES('$g','$activitystatus','$inputdate6','$inputtime6','$inputdetail6','$inputtotal','$inputterm','$inputdatepay1','$inputpercentpay1','$inputdatepay2','$inputpercentpay2','$inputdatepay3','$inputpercentpay3','$inputdatepay4','$inputpercentpay4','$inputdatepay5','$inputpercentpay5','$inputdatepay6','$inputpercentpay6','$myCheckBoxID','$System_Session_User_ID','$System_Session_UserName',Now())";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
	$sql = "INSERT INTO ".$myModule_Table2."(".$myModule_Table2."_DateFrom,".$myModule_Table2."_DateTo,".$myModule_Table2."_TimeFrom,".$myModule_Table2."_Subject,".$myModule_Table2."_CreateByID,".$myModule_Table2."_CreateBy,".$myModule_Table2."_CreateDate,".$myModule_Table2."_Status,".$myModule_Table2."_Language,".$myModule_Table2."_GroupID) VALUES('$inputdate','$inputdate','$inputtime','$inputdetail','$System_Session_User_ID','$System_Session_UserName',Now(),'Enable','Thai','9')";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");

	}	
		if($activitystatus=="closesale")
	{
	$sql = "INSERT INTO ".$myModule_Table1."(".$myModule_Table1."_ID,".$myModule_Table1."_Activitystatus,".$myModule_Table1."_Date,".$myModule_Table1."_Time,".$myModule_Table1."_Detail,".$myModule_Table1."_Total,".$myModule_Table1."_Term,".$myModule_Table1."_Datepay1,".$myModule_Table1."_Percentpay1,".$myModule_Table1."_Datepay2,".$myModule_Table1."_Percentpay2,".$myModule_Table1."_Datepay3,".$myModule_Table1."_Percentpay3,".$myModule_Table1."_Datepay4,".$myModule_Table1."_Percentpay4,".$myModule_Table1."_Datepay5,".$myModule_Table1."_Percentpay5,".$myModule_Table1."_Datepay6,".$myModule_Table1."_Percentpay6,".$myModule_Table1."_Customerid,".$myModule_Table1."_CreateByID,".$myModule_Table1."_CreateBy,".$myModule_Table1."_CreateDate) VALUES('$g','$activitystatus','$inputdate6','$inputtime6','$inputdetail6','$inputtotal','$inputterm','$inputdatepay1','$inputpercentpay1','$inputdatepay2','$inputpercentpay2','$inputdatepay3','$inputpercentpay3','$inputdatepay4','$inputpercentpay4','$inputdatepay5','$inputpercentpay5','$inputdatepay6','$inputpercentpay6','$myCheckBoxID','$System_Session_User_ID','$System_Session_UserName',Now())";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
	}	
	if($activitystatus=="uncompletesale")
	{
	$sql = "INSERT INTO ".$myModule_Table1."(".$myModule_Table1."_ID,".$myModule_Table1."_Activitystatus,".$myModule_Table1."_Date,".$myModule_Table1."_Time,".$myModule_Table1."_Detail,".$myModule_Table1."_Total,".$myModule_Table1."_Term,".$myModule_Table1."_Datepay1,".$myModule_Table1."_Percentpay1,".$myModule_Table1."_Datepay2,".$myModule_Table1."_Percentpay2,".$myModule_Table1."_Datepay3,".$myModule_Table1."_Percentpay3,".$myModule_Table1."_Datepay4,".$myModule_Table1."_Percentpay4,".$myModule_Table1."_Datepay5,".$myModule_Table1."_Percentpay5,".$myModule_Table1."_Datepay6,".$myModule_Table1."_Percentpay6,".$myModule_Table1."_Customerid,".$myModule_Table1."_CreateByID,".$myModule_Table1."_CreateBy,".$myModule_Table1."_CreateDate) VALUES('$g','$activitystatus','$inputdate6','$inputtime6','$inputdetail6','$inputtotal','$inputterm','$inputdatepay1','$inputpercentpay1','$inputdatepay2','$inputpercentpay2','$inputdatepay3','$inputpercentpay3','$inputdatepay4','$inputpercentpay4','$inputdatepay5','$inputpercentpay5','$inputdatepay6','$inputpercentpay6','$myCheckBoxID','$System_Session_User_ID','$System_Session_UserName',Now())";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	}	

	//if($DisplayStyle!="Link"){
				//$sql = "SELECT MAX(".$myModule_Table."_ID) FROM ".$myModule_Table;
				//$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
				//$Row=MYSQL_FETCH_ARRAY($Query);
				//$MaxID = $Row[0];
				
				
			
				srand(make_seed());
				$myrand = rand(1111,9999);
				
				// Check to create module data directory. ---------
					if(!is_dir($System_RelativePath_Upload."/".$SystemModuleKey)) { mkdir($System_RelativePath_Upload."/".$SystemModuleKey,0777); }
					if(!is_dir($myModule_Path_ThumbnailPicture)) { mkdir($myModule_Path_ThumbnailPicture,0777); }
				// ------------------------------------------------
			
					if(isset($_FILES['inputThumbnailPicture'])) {
							if($_FILES['inputThumbnailPicture']['error']==0){				
									$exts = explode(".", $_FILES['inputThumbnailPicture']['name']);
									$ext = strtolower(($exts[count($exts) - 1]));	
									$ImageType = $ext;
									$ThumbnailPictureName = "$MaxID-$myrand.$ImageType";
									if(file_exists($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
											unlink($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName);
									}
									if(move_uploaded_file($_FILES['inputThumbnailPicture']['tmp_name'],$myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
										chmod($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName,0777);
									}
									$sql = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_PictureFile='$ThumbnailPictureName' WHERE ".$myModule_Table."_ID=".$MaxID;
									$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
							}
					}
					/*if(is_file($inputThumbnailPicture)) {
						$ImageData = getimagesize($inputThumbnailPicture);
						if($ImageData!=NULL) {
							if($ImageData[2]==1) { 
								$ImageType="gif";
							} elseif($ImageData[2]==2) {
								$ImageType="jpg";
							}
							$ThumbnailPictureName = "$MaxID-$myrand.$ImageType";
							if(file_exists($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
								unlink($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName);
							}
							if(copy($inputThumbnailPicture,$myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
								chmod($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName,0777);
							}
							$sql = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_PictureFile='$ThumbnailPictureName' WHERE ".$myModule_Table."_ID=".$MaxID;
							$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
						}
						*/
					//}
	//}
?>                    
                    <form action="?" method="post" name="myForm" id="myForm">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                      <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?>">
                    </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
<? }elseif($action=="edit") { 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	$sql="SELECT * FROM cm_listsubject WHERE cm_listsubject_ID='$myCheckBoxID'";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=MYSQL_FETCH_ARRAY($Query);
?>
                    <br>
                    <br>
                    <table style="border-collapse: collapse" border="1" width="95%" align="center" cellpadding="0" cellspacing="1" class="table_border" bordercolor="#E8E7E1">
                      <form action="?" method="post" name="myReturnForm" id="myReturnForm">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                        <input name="action" type="hidden" id="action" value="">
                        <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?>">
                      </form>
                      <form action="?" method="post" name="myForm" id="myForm" enctype="multipart/form-data"  onSubmit=" if(!verifySubmit()) { return false; } ">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                        <input name="action" type="hidden" id="action" value="update">
                        <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="CheckBoxID1" type="hidden" id="CheckBoxID1" value="<?=$myCheckBoxID?>">
                        <input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="1">						
                        <tr> 
                          <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="mytable_inner">
                              
                              <tr align="center"> 
                                <td height="24" colspan="2" align="center" class="table_title2" style="font-weight: bold">แก้ไขข้อมูล</td>
                              </tr>
                              <tr>
                                <td width="236" height="24" align="right" class="table_row2">รายวิชา : </td>
                                <td width="428" class="table_col2"><input name="Subject" type="text" class="input_left" id="Subject" size="40" maxlength="100" value="<?=$Row[cm_listsubject_Name]?>" />
                                    <span style="color: #FF0000">*</span></td>
                              </tr>
                              <tr>
                                <td height="24" align="right" class="table_row2">นักศึกษาที่เรียน : </td>
                                <td class="table_col2"><span class="style3">
                                  <select name="Studentyear" id="Studentyear">
                                    <option value="ปี 1" <? if($Row[cm_listsubject_Studentyear]=="ปี 1"){echo"selected";}?>>ปี 1</option>
                                    <option value="ปี 2" <? if($Row[cm_listsubject_Studentyear]=="ปี 2"){echo"selected";}?>>ปี 2</option>
                                    <option value="ปี 3" <? if($Row[cm_listsubject_Studentyear]=="ปี 3"){echo"selected";}?>>ปี 3</option>
                                    <option value="ปี 4" <? if($Row[cm_listsubject_Studentyear]=="ปี 4"){echo"selected";}?>>ปี 4</option>
                                    <option value="ปี 5" <? if($Row[cm_listsubject_Studentyear]=="ปี 5"){echo"selected";}?>>ปี 5</option>
                                    <option value="ปี 6" <? if($Row[cm_listsubject_Studentyear]=="ปี 6"){echo"selected";}?>>ปี 6</option>
                                  </select>
                                </span></td>
                              </tr>
                              
							  														    
                            </table>
                            <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                              <tr align="right"> 
                                <td height="30" colspan="4" align="center" class="table_row2"> 
                                  <table width="300" border="0" cellspacing="0" cellpadding="2">
                                    <tr align="center"> 
                                      <td>
<script language="JavaScript" type="text/JavaScript">
function isBlank(myObj) { if(myObj.value=='') { return true; } return false; }
function verifySubmit() {
	with(document.myForm) {
 <? if($DisplayStyle!="Picture"){?>
		if(inputName.value=='') {
			inputName.focus();
			return false;
		}
 <? }?>
 <? if($DisplayStyle!="Link"){?>
		myfile = inputThumbnailPicture.value;
		if(myfile!='') {
			myfile = myfile.toLowerCase();
			Temp = myfile.charAt(myfile.length-4) + myfile.charAt(myfile.length-3) + myfile.charAt(myfile.length-2) + myfile.charAt(myfile.length-1);
			if(Temp=='.jpg' || Temp=='.gif' || Temp=='jpeg') {
				document.getElementById('PreviewImage').src=myfile;
				document.getElementById('PreviewImageText').innerHTML= document.getElementById('PreviewImage').width + 'x' + document.getElementById('PreviewImage').height + ' pixel';
			} else {
				alert('System allow to upload image files only.');
				document.myForm.inputThumbnailPicture.focus();
				return false; 
			}
		}
<? }?>
		if(inputURL.value=='') {
			inputURL.focus();
			return false;
		}		
	}
	return true;
}
						</script> <input name="btSave" type="submit" class="button_60" id="btSave" value="บันทึก">                                      </td>
                                      <td> <input name="btCalcel" type="button" class="button_60" id="btCalcel" onClick="
if(confirm('Are you sure to return to list?')) {
	document.myReturnForm.submit();
}
						" value="ย้อนกลับ"> </td>
                                    </tr>
                                  </table></td>
                              </tr>
                            </table></td>
                        </tr>
                      </form>
                    </table>
<? 
##############################################
 }elseif($action=="view") { 
 $CheckBoxID=$_GET["CheckBoxID"];
 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	//$sql = "SELECT * FROM crm_mod_customer p,crm_mod_customer_history t WHERE p.crm_mod_customer_ID  = crm_mod_customer_history_ID  AND p.crm_mod_customer_ID=".$myCheckBoxID;
 $sql="SELECT * FROM roadpump_typepump WHERE roadpump_typepump_ID='$myCheckBoxID'";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=MYSQL_FETCH_ARRAY($Query);
?>
                    <br>
                    <br>
                    <br />
                    <table style="border-collapse: collapse" border="1" bordercolor="#E8E7E1" width="95%" align="center" cellpadding="0" cellspacing="1" class="table_border">
                      <form action="?" method="post" name="myReturnForm" id="myReturnForm">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="admin" type="hidden" id="admin" value="<?=$admin?>">

                        <input name="action" type="hidden" id="action" value="">
                        <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?>">
                      </form>
                      <form action="?" method="post" name="myForm" id="myForm" >
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                        <input name="action" type="hidden" id="action" value="update">
                        <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="CheckBoxID1" type="hidden" id="CheckBoxID1" value="<?=$myCheckBoxID?>">
                        <input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="1">						
                        <tr> 
                          <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="mytable_inner">
                              
                              <tr align="center"> 
                                <td height="24" colspan="3" align="center" class="table_title2" style="font-weight: bold">ดูข้อมูล</td>
                              </tr>
                              <tr>
                                <td width="228" height="31" align="right" class="table_row2">แพทยภา : </td> 
                                <td width="460" colspan="2" class="table_row2"><?=$Row[roadpump_typepump_Name]?></td>
                              </tr>
                              														    
                            </table>
                            <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                              <tr align="right"> 
                                <td height="30" colspan="4" align="center" class="table_row2"> 
                                  <table width="300" border="0" cellspacing="0" cellpadding="2">
                                    <tr align="center"> 
 <? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>                                  
								      <td>
 <input name="btEdit" type="submit" class="button_80" id="btEdit" value="แก้ไขข้อมูล" onClick="
document.myForm.action.value='edit';
document.myForm.submit();
						">                                      </td>
<? }?>						
                                      <td> <input name="btCalcel" type="button" class="button_80" id="btCalcel" onClick="
if(confirm('Are you sure to return to list?')) {
	document.myReturnForm.submit();
}
						" value="ย้อนกลับ"> </td>
                                    </tr>
                                  </table></td>
                              </tr>
                            </table></td>
                        </tr>
                      </form>
                    </table>
					</form>
                    <br />
					<? 
//########################################################
} else if ($action=="update") { 
	$MaxID = $CheckBoxID1;
	$sql = "UPDATE cm_listsubject SET cm_listsubject_Name='$Subject',cm_listsubject_Studentyear='$Studentyear' WHERE cm_listsubject_ID='$CheckBoxID1'";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
?>
<form action="?" method="post" name="myForm" id="myForm">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                      <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?>">
                    </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
 <? 
#########################################################
}elseif ($action=="delete") { 
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			
			$sql = "DELETE FROM cm_listsubject WHERE cm_listsubject_ID=".$$myVar;
			$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
		}
	}
?>
                    <form action="?" method="post" name="myForm" id="myForm">
                      <input name="action" type="hidden" id="action">
                      <input name="GroupID" type="hidden" id="GroupID" value="<?=$GroupID?>">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <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?>">
                    </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
                    <? 
#########################################################
} else if ($action=="setstatus") { 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	$sql="UPDATE ".$myModule_Table." SET ".$myModule_Table."_Status='$SelectStatus' WHERE ".$myModule_Table."_ID=".$myCheckBoxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
?>
                    <form action="?" method="post" name="myForm" id="myForm">
                      <input name="action" type="hidden" id="action">
                      <input name="GroupID" type="hidden" id="GroupID" value="<?=$GroupID?>">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <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?>">
                    </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
                    <?	
#########################################################
} else { ?>
<?
# 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($GroupID=="") { $GroupID=0; }

# Count total record size #########################
$sql = "SELECT * FROM cm_listsubject";
$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("<br><br><b><font color=#FF0000>ไม่สามารถใช้งานระบบได้<br>หากคุณเข้าใช้งานเป็นครั้งแรก<br><a href=\"#\" onClick=\"Popup('popupCreateDatabaseWindow','createdatabase.php',220,180,1);\">กรุณาคลิ๊กที่นี่</a><br>เพื่อทำการสร้างฐานข้อมูลใหม่</font></b>\n");
if($PageSearch=="") {
	$sql = "SELECT * FROM cm_listsubject";
	} else {
		$sql = $sql."  WHERE  (cm_listsubject_Name LIKE '%$PageSearch%') ";
}

$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("<br><br><b><font color=#FF0000>ไม่สามารถใช้งานระบบได้<br>หากคุณเข้าใช้งานเป็นครั้งแรก<br><a href=\"#\" onClick=\"Popup('popupCreateDatabaseWindow','createdatabase.php',220,180,1);\">กรุณาคลิ๊กที่นี่</a><br>เพื่อทำการสร้างฐานข้อมูลใหม่</font></b>\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;

$sql.=" ORDER BY cm_listsubject_Studentyear ASC LIMIT $RecordStart , $PageSize";
$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
$RecordCount=MYSQL_NUMROWS($Query);
?>
                    <script language="JavaScript" type="text/JavaScript">
function Paging_CheckAll(objCheckHeader,txtCheckBoxFirstName,intTotalItems) {
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			document.getElementById(txtCheckBoxFirstName+i).checked = objCheckHeader.checked;			
	return true;

}
function Paging_CheckAllHandle(objCheckHeader,txtCheckBoxFirstName,intTotalItems) {
	var isCheckedAll = true;
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			if(!document.getElementById(txtCheckBoxFirstName+i).checked) 
			isCheckedAll = false;
	objCheckHeader.checked = isCheckedAll;
	return true;
}
function Paging_CountChecked(txtCheckBoxFirstName,intTotalItems) {
	var intChecked = 0;
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			if(document.getElementById(txtCheckBoxFirstName+i).checked) 
			intChecked ++;
	return intChecked ;
}
function Paging_CheckedThisItem(objCheckHeader,indexing,txtCheckBoxFirstName,intTotalItems) {
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			if(i==indexing) {
				document.getElementById(txtCheckBoxFirstName+i).checked = true;
			} else {
				document.getElementById(txtCheckBoxFirstName+i).checked = false;
			}
	objCheckHeader.checked = false;
	return true;
}
</script>
                    <div id="divDataPicker" style="display:none; position:absolute; top:-135px; left:81px; width: 200px; z-index: 1;Filter:Alpha(opacity=95)"> 
                      <table width="100%" border="0" cellpadding="0" cellspacing="1" class="table_border">
                        <form action="?" method="post" name="myStatusForm" id="myStatusForm">
                          <input name="GroupID" type="hidden" id="GroupID" value="<?=$GroupID?>">
                          <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                          <tr> 
                            <td height="22"><table width="100%" height="22" border="0" cellpadding="0" cellspacing="0" class="table_header">
                                <tr> 
                                  <td width="28" align="center"><img src="../images/icon/ico439.gif" width="19" height="15"></td>
                                  <td align="center">Select Status</td>
                                  <td width="22" align="center"><img src="../images/icon/ico215.gif" width="16" height="16" onMouseOver="this.style.cursor='hand'" onClick="document.getElementById('divDataPicker').style.display='none'; "></td>
                                </tr>
                              </table></td>
                          </tr>
                          <tr> 
                            <td height="120" align="center" class="table_row1"><br> 
                              <table width="120" border="0" cellpadding="2" cellspacing="0">
                                <tr> 
                                  <td height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="Enable"></td>
                                  <td height="22" class="text_bold">Enable</td>
                                </tr>
                                <tr> 
                                  <td width="26" height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="Disable"></td>
                                  <td height="22" class="text_bold">Disable</td>
                                </tr>
                              </table>
                              <br> <table border="0" cellspacing="0" cellpadding="6">
                                <tr> 
                                  <td><input name="btSave" type="button" class="button_th_60" id="btSave" value="Save" onClick="
if(document.myStatusForm.toolbarStatus[0].checked) {
	document.myForm.SelectStatus.value=document.myStatusForm.toolbarStatus[0].value;
}
if(document.myStatusForm.toolbarStatus[1].checked) {
	document.myForm.SelectStatus.value=document.myStatusForm.toolbarStatus[1].value;
}
document.myForm.action.value='setstatus';
Paging_CheckedThisItem(document.myForm.CheckBoxAll, StatusIndex ,'CheckBoxID', document.myForm.TotalCheckBoxID.value );
document.myForm.submit();
"></td>
                                  <td><input name="btClose" type="button" class="button_th_60" id="btClose" value="Close" onClick="document.getElementById('divDataPicker').style.display='none';"></td>
                                </tr>
                              </table></td>
                          </tr>
                          <tr> 
                            <td height="6" class="table_footer"><img src="../images/blank.gif" width="1" height="1"></td>
                          </tr>
                        </form>
                      </table>
                    </div>
                    <script language="JavaScript" type="text/JavaScript">
var StatusIndex=0;
function ShowDataPicker(myDivName,RefX,RefY) {
	document.getElementById(myDivName).style.display=''; 
	document.getElementById(myDivName).style.left = document.body.scrollLeft + window.event.clientX + RefX;
	document.getElementById(myDivName).style.top= document.body.scrollTop+ window.event.clientY + RefY;
}
	  </script>
                    <table width="95%" border="0" align="center" cellpadding="2" cellspacing="0" >
                  <form action="" method="post" name="mySearchForm1" id="mySearchForm1" onsubmit="return false;">
                    <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>" />
                    <input name="SystemMenuID2" type="hidden" id="SystemMenuID2" value="<?=$SystemMenuID?>" />
                    <tr>
                      <td>
                        
                        <div align="right">
                          <input name="toolbarPageSearch1" type="text"  style="height:15px"class="input_left" id="toolbarPageSearch1" value="<?=$PageSearch?>" size="20" maxlength="50" />                        
                          <input name="btPageSearch" type="button" class="button_60" id="btPageSearch" value="ค้นหาข้อมูล" onclick="
document.myForm.PageSearch.value=document.mySearchForm1.toolbarPageSearch1.value;
document.myForm.submit();
						" />
                          <input name="btAdd2" type="button" class="button_80" id="btAdd2" value="เพิ่มข้อมูลใหม่" onclick="
document.myForm.action.value='add';
document.myForm.submit();
				" />
                      </div></td></tr>
                  </form>
                </table>
                    <br />
                    <table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="table_border">
                      <tr> 
                        <td bgcolor="#FFFFFF">  <table style="border-collapse: collapse" border="1" width="98%" align="center" cellpadding="0" cellspacing="1" class="table_border" bordercolor="#E8E7E1">
                            <form action="?" method="post" name="myForm" id="myForm">
                              <input name="GroupID" type="hidden" id="GroupID" value="<?=$GroupID?>">
                              <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                              <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                              <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="menu_table_header">
                                <td height="24" colspan="6" bgcolor="#F7F6F0" class="table_title1"><div align="left">ข้อมูลรายวิชา</div></td>
                                </tr>
                              <tr align="center" class="menu_table_header"> 
                                <td width="59" height="24" bgcolor="#F7F6F0" class="table_title2"><input name="CheckBoxAll" type="checkbox" class="form_checkbox" id="CheckBoxAll" value="Yes" onClick="Paging_CheckAll(this,'CheckBoxID',document.myForm.TotalCheckBoxID.value)"></td>
                                <td width="59" height="24" align="center" bgcolor="#F7F6F0" class="table_title2">No.</td>
					<? if($DisplayStyle!="Link"){?>
                                <? }?>
                                <td width="179" height="24" bgcolor="#F7F6F0" class="table_title2">รายวิชา</td>
                                
                                <td width="96" bgcolor="#F7F6F0" class="table_title2">นักศึกษาที่เรียน</td>
                                <td width="122" height="24" bgcolor="#F7F6F0" class="table_title2">วันที่เพิ่ม</td>
                                <td width="129" height="24" bgcolor="#F7F6F0" class="table_title2">Action</td>
                              </tr>
                              <?
$index=1;
if($RecordCount>0) {
	while($index<$RecordCount+1) {
		if($myClassRow=="table_row1") { $myClassRow="table_row2"; } else { $myClassRow="table_row1";  }
		$Row=MYSQL_FETCH_ARRAY($Query);
	?>
                              <tr class="<?=$myClassRow?>"> 
                                <td width="59" height="30" align="center"> <input name="CheckBoxID<?=$index?>" type="checkbox" class="form_checkbox" id="CheckBoxID<?=$index?>" onClick="Paging_CheckAllHandle(document.myForm.CheckBoxAll,'CheckBoxID',document.myForm.TotalCheckBoxID.value)" value="<?=$Row[cm_listsubject_ID]?>"></td>
                                <td width="59" height="30" align="center"> 
                                  <? if($ASCDESC=="DESC") { echo $RecordStart+$index; } else { echo ($TotalRecordCount-($RecordStart+$index)+1); } ?></td>
							
								<td height="30"> 
                                  <div align="center"><strong>
                                  <span class="menu_one">
                                    <a href="../system/mod_dataoverall/indexadmin.php?listid=<?=$Row[cm_listsubject_ID]?>&subject=<?=$Row[cm_listsubject_Name]?>&studentyear=<?=$Row[cm_listsubject_Studentyear]?>"><?=$Row[cm_listsubject_Name]?></a></span>
                                  </strong></div></td>
                                
                                <td height="30"><div align="center"><strong>
                                  <?=$Row[cm_listsubject_Studentyear]?>
                                </strong></div></td>
                                <td width="122" height="30" align="center"> 
                                  <div align="center">
                                    <? $sql="select * from cm_mod_detailoverall where cm_mod_detailoverall_ListsubjectID='$Row[cm_listsubject_ID]'";
								   $query=mysql_query($sql);
								 
								   echo $num=mysql_num_rows($query);                                
								   ?>
                                  </div></td>
                                <td width="129" height="30" align="center" valign="middle"> 
                                  <table border="0" cellspacing="0" cellpadding="1">
                                    <tr align="center" valign="bottom">
<td>
<img src="../img/icons/edit.png" alt="แก้ไขข้อมูล" width="16" height="16" border="0" onMouseOver="this.style.cursor='hand'" onClick="
if(confirm('Are you sure to edit this record?')) {
	Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
	document.myForm.action.value='edit';
	document.myForm.submit();
}
						"></td>									
									  <td style="display:none"> <img src="../img/icons/delete.png" alt="ลบข้อมูล" width="16" height="16" border="0" onMouseOver="this.style.cursor='hand'" onClick="
if(confirm('Are you sure to delete this record?')) {
	Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
	document.myForm.action.value='delete';
	document.myForm.submit();
}
						"></td>
                        <td>
                         <? if($System_Session_Level=="Administrator"){ ?>
                        <img src="../img/icons/page_add.png" alt="เพิ่มข้อมูลวัน/เวลา" width="16" height="16" border="0" onMouseOver="this.style.cursor='hand'" onClick="window.location='../system/mod_dataoverall/indexadmin.php?listid=<?=$Row[cm_listsubject_ID]?>&subject=<?=$Row[cm_listsubject_Name]?>&studentyear=<?=$Row[cm_listsubject_Studentyear]?>'">
                        <? } ?>
                        <? if($System_Session_Level=="Staff"){ ?>
                        <img src="../img/icons/page_add.png" alt="เพิ่มข้อมูลวัน/เวลา" width="16" height="16" border="0" onMouseOver="this.style.cursor='hand'" onClick="window.location='../system/mod_dataoverall/indexperson.php?listid=<?=$Row[cm_listsubject_ID]?>&subject=<?=$Row[cm_listsubject_Name]?>&studentyear=<?=$Row[cm_listsubject_Studentyear]?>'">
                        <? } ?>
                        </td>
                                    </tr>
                                </table></td>
                              </tr>
                              <?
		$index++;
	}
} else {  ?>
                              <tr class="table_row1"> 
                                <td height="80" colspan="8" align="center"> ไม่พบข้อมูล!</td>
                              </tr>
                              <? } ?>
                              <input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="<?=$index-1?>">
                            </form>
                          </table>
                          <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                            <form action="?" method="post" name="mySearchForm" id="mySearchForm" onSubmit="return false;">
                              <input name="GroupID" type="hidden" id="GroupID" value="<?=$GroupID?>">
                              <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                              <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                              <tr align="right"> 
                                <td colspan="4" align="right" class="table_footer"><div class="menu_one"> 
                                  <div align="left">หน้า
                                    <? 
				  if($NoOfPage>1) { 
				  ?>
                                    <select name="toolbarPageShow" class="select" onchange="document.myForm.PageShow.value=this.value; document.myForm.submit(); ">
                                      <? 
if($NoOfPage<$SystemModule_MaxPage) {
	// Show page list #########################
	for($i=1;$i<=$NoOfPage;$i++) { 
		echo "<option value=\"$i\"";
		if($i==$PageShow) { echo " selected"; }
		echo ">$i</option>";
	} 
}  else {
	// # If total page count greater than default max page  value then reduce page select size #########################
	$starti = $PageShow-$SystemModule_ReduceRange;
	if($starti<1) { $starti=1; }
	$endi = $PageShow+$SystemModule_ReduceRange;
	if($endi>$NoOfPage) { $endi=$NoOfPage; }
	//#####################
	for($i=$starti ;$i<=$endi;$i++) { 
		echo "<option value=\"$i\"";
		if($i==$PageShow) { echo " selected"; }
		echo ">$i</option>";
	} 
}
?>
                                    </select>
                                    <? 
 } else { 
	echo "1";
 }
 ?>
จาก
<?=$NoOfPage?>
 | ค้นพบทั้งหมด
 <?=$TotalRecordCount?>
 รายการ</div>
                                </div></td>
                              </tr>
                            </form>
                          </table></td>
                      </tr>
                    </table>
                    <br>
                    <? 
}
#########################################################
?>
                    
                    <p>&nbsp; </p>
                    <p align="right">&nbsp;</p>
    	          </div>
                   <? } if($System_Session_Level=="Admin") { ?>
                   <? 
## Load Module Configuration Variable ############################################

## Default Value ############################################
$SystemModule_defaultPageSize = 10;
$SystemModule_defaultPageShow = 1;
$SystemModule_MaxPage = 20;
$SystemModule_ReduceRange = 10; 		// +,- from current page show
$SystemModule_ASCDESC = "DESC";
$SystemModule_OrderBy = $myModule_Table."_ID";

#########################################################
?>
                      <? if($action=="add") { ?>
                    </p>
                    <table style="border-collapse: collapse" border="1" width="95%" align="center" cellpadding="0" cellspacing="1" class="table_border" bordercolor="#E8E7E1">
                      <form action="?" method="post" name="myReturnForm" id="myReturnForm">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                        <input name="action" type="hidden" id="action" value="">
                        <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?>">
                      </form>
                      <form action="?" method="post" name="myForm" id="myForm" enctype="multipart/form-data"  onSubmit=" if(!verifySubmit()) { return false; } ">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                        <input name="action" type="hidden" id="action" value="addnew">
                        <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?>">
                        <tr> 
                          <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="mytable_inner">
                              
                              <tr align="center"> 
                                <td height="24" colspan="2" align="center" bgcolor="#F7F6F0" class="table_title2" style="font-weight: bold">เพิ่มข้อมูล                                  </td>
                              </tr>
                              <tr> 
                                <td width="198" height="24" align="right" class="table_row2">รายวิชา : </td>
                                <td width="486" class="table_col2"><input name="Subject" type="text" class="input_left" id="inputtypepump" size="40" maxlength="100">
                                <span style="color: #FF0000">*</span></td>
                              </tr>
                              <tr>
                                <td height="24" align="right" class="table_row2">นักศึกษาที่เรียน : </td>
                                <td class="table_col2"><span class="style3">
                                  <select name="Studentyear" id="select3">
                                    <option value="ปี 1">ปี 1</option>
                                    <option value="ปี 2">ปี 2</option>
                                    <option value="ปี 3">ปี 3</option>
                                    <option value="ปี 4">ปี 4</option>
                                    <option value="ปี 5">ปี 5</option>
                                    <option value="ปี 6">ปี 6</option>
                                  </select>
                                </span></td>
                              </tr>
                              
							  														    
                            </table>
							
                            <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                              <tr align="right"> 
                                <td height="30" colspan="4" align="center" class="table_row2"> 
                                  <table width="300" border="0" cellspacing="0" cellpadding="2">
                                    <tr align="center"> 
                                      <td> 
<script language="JavaScript" type="text/JavaScript">
function isBlank(myObj) { if(myObj.value=='') { return true; } return false; }
function verifySubmit() {
 	with(document.myForm) {
				if(inputconcrete.value=='') {
				alert('กรุณากรอกคอนกรีตที่ใช้');
					inputconcrete.focus();
					return false;
				}
	
	}
	return true;
}
						</script> <input name="btAdd" type="submit" class="button_60" id="btAdd" value="บันทึก"> 
					&nbsp;&nbsp;&nbsp;	                                       <input name="btCalcel" type="button" class="button_60" id="btCalcel" onClick="
if(confirm('Are you sure to return to list?')) {
	document.myReturnForm.submit();
}
						" value="ย้อนกลับ"> </td>
                                    </tr>
                                  </table></td>
                              </tr>
                            </table></td>
                        </tr>
                      </form>
                    </table>
                    <? 
//########################################################
} else if ($action=="addnew") { 
?>
<form action="?" method="post" name="myForm" id="myForm">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                      <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?>">
              </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
	<?
	 $sql = "INSERT INTO cm_listsubject(cm_listsubject_Name,cm_listsubject_Studentyear,cm_listsubject_Createdate,cm_listsubject_Createby,cm_listsubject_Createbyid,cm_listsubject_Staffid) VALUES('$Subject','$Studentyear',Now(),'$System_Session_UserName','$System_Session_User_ID','$System_Session_User_ID')";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
?>                    
                    <form action="?" method="post" name="myForm" id="myForm">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                      <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?>">
                    </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
					
					
					
<? } else if($action=="addproject") { 
?>

  <!-- import the calendar script -->
                    <link rel="stylesheet" type="text/css" href="../../css/myCalendarStyle.css">
                    <script type="text/javascript" src="../mod_calendar/lib/calendar.js"></script>
                    <script type="text/javascript" src="../mod_calendar/lib/lang/calendar-en.js"></script>
                    <script type="text/javascript" src="../mod_calendar/lib/loadcalendar.js"></script>
                    <!-- end the calendar script -->
                    <? 
//########################################################
} else if ($action=="addnewproject") { 
$sql="select max(crm_mod_project_ID) from crm_mod_project";
$query=mysql_query($sql);
$row=mysql_fetch_array($query);
$in=$row[0];
$g=$in+1;

$image_W=getimagesize($inputThumbnailPicture); //Cjeck ขนาดภาพ
$image_H=getimagesize($inputThumbnailPicture);
if ($image_W[0]>150 || $image_H[1]>40) { 
echo "<SCRIPT LANGUAGE=\"JavaScript\">alert(\"use a picture file size as 150 x 40 pixel.\");</SCRIPT>";
?>
<form action="?" method="post" name="myForm" id="myForm">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                      <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?>">
              </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
	<?
	exit(); }

	//if($inputLinkType=="Group") $inputURL="";
	if($activitystatus=="track")
	{
	 $sql = "INSERT INTO ".$myModule_Table1."(".$myModule_Table1."_ID,".$myModule_Table1."_Activitystatus,".$myModule_Table1."_Date,".$myModule_Table1."_Time,".$myModule_Table1."_Detail,".$myModule_Table1."_Total,".$myModule_Table1."_Term,".$myModule_Table1."_Datepay1,".$myModule_Table1."_Percentpay1,".$myModule_Table1."_Datepay2,".$myModule_Table1."_Percentpay2,".$myModule_Table1."_Datepay3,".$myModule_Table1."_Percentpay3,".$myModule_Table1."_Datepay4,".$myModule_Table1."_Percentpay4,".$myModule_Table1."_Datepay5,".$myModule_Table1."_Percentpay5,".$myModule_Table1."_Datepay6,".$myModule_Table1."_Percentpay6,".$myModule_Table1."_Customerid,".$myModule_Table1."_CreateByID,".$myModule_Table1."_CreateBy,".$myModule_Table1."_CreateDate) VALUES('$g','$activitystatus','$inputdate','$inputtime','$inputdetail','$inputtotal','$inputterm','$inputdatepay1','$inputpercentpay1','$inputdatepay2','$inputpercentpay2','$inputdatepay3','$inputpercentpay3','$inputdatepay4','$inputpercentpay4','$inputdatepay5','$inputpercentpay5','$inputdatepay6','$inputpercentpay6','$myCheckBoxID','$System_Session_User_ID','$System_Session_UserName',Now())";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
	$sql = "INSERT INTO ".$myModule_Table2."(".$myModule_Table2."_DateFrom,".$myModule_Table2."_DateTo,".$myModule_Table2."_TimeFrom,".$myModule_Table2."_Subject,".$myModule_Table2."_CreateByID,".$myModule_Table2."_CreateBy,".$myModule_Table2."_CreateDate,".$myModule_Table2."_Status,".$myModule_Table2."_Language,".$myModule_Table2."_GroupID) VALUES('$inputdate','$inputdate','$inputtime','$inputdetail','$System_Session_User_ID','$System_Session_UserName',Now(),'Enable','Thai','4')";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	}	
	if($activitystatus=="requestdata")
	{
	$sql = "INSERT INTO ".$myModule_Table1."(".$myModule_Table1."_ID,".$myModule_Table1."_Activitystatus,".$myModule_Table1."_Date,".$myModule_Table1."_Time,".$myModule_Table1."_Detail,".$myModule_Table1."_Total,".$myModule_Table1."_Term,".$myModule_Table1."_Datepay1,".$myModule_Table1."_Percentpay1,".$myModule_Table1."_Datepay2,".$myModule_Table1."_Percentpay2,".$myModule_Table1."_Datepay3,".$myModule_Table1."_Percentpay3,".$myModule_Table1."_Datepay4,".$myModule_Table1."_Percentpay4,".$myModule_Table1."_Datepay5,".$myModule_Table1."_Percentpay5,".$myModule_Table1."_Datepay6,".$myModule_Table1."_Percentpay6,".$myModule_Table1."_Customerid,".$myModule_Table1."_CreateByID,".$myModule_Table1."_CreateBy,".$myModule_Table1."_CreateDate) VALUES('$g','$activitystatus','$inputdate2','$inputtime2','$inputdetail2','$inputtotal','$inputterm','$inputdatepay1','$inputpercentpay1','$inputdatepay2','$inputpercentpay2','$inputdatepay3','$inputpercentpay3','$inputdatepay4','$inputpercentpay4','$inputdatepay5','$inputpercentpay5','$inputdatepay6','$inputpercentpay6','$myCheckBoxID','$System_Session_User_ID','$System_Session_UserName',Now())";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
		$sql = "INSERT INTO ".$myModule_Table2."(".$myModule_Table2."_DateFrom,".$myModule_Table2."_DateTo,".$myModule_Table2."_TimeFrom,".$myModule_Table2."_Subject,".$myModule_Table2."_CreateByID,".$myModule_Table2."_CreateBy,".$myModule_Table2."_CreateDate,".$myModule_Table2."_Status,".$myModule_Table2."_Language,".$myModule_Table2."_GroupID) VALUES('$inputdate','$inputdate','$inputtime','$inputdetail','$System_Session_User_ID','$System_Session_UserName',Now(),'Enable','Thai','5')";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");

	}	
	if($activitystatus=="requestquotation")
	{
	$sql = "INSERT INTO ".$myModule_Table1."(".$myModule_Table1."_ID,".$myModule_Table1."_Activitystatus,".$myModule_Table1."_Date,".$myModule_Table1."_Time,".$myModule_Table1."_Detail,".$myModule_Table1."_Total,".$myModule_Table1."_Term,".$myModule_Table1."_Datepay1,".$myModule_Table1."_Percentpay1,".$myModule_Table1."_Datepay2,".$myModule_Table1."_Percentpay2,".$myModule_Table1."_Datepay3,".$myModule_Table1."_Percentpay3,".$myModule_Table1."_Datepay4,".$myModule_Table1."_Percentpay4,".$myModule_Table1."_Datepay5,".$myModule_Table1."_Percentpay5,".$myModule_Table1."_Datepay6,".$myModule_Table1."_Percentpay6,".$myModule_Table1."_Customerid,".$myModule_Table1."_CreateByID,".$myModule_Table1."_CreateBy,".$myModule_Table1."_CreateDate) VALUES('$g','$activitystatus','$inputdate3','$inputtime3','$inputdetail3','$inputtotal','$inputterm','$inputdatepay1','$inputpercentpay1','$inputdatepay2','$inputpercentpay2','$inputdatepay3','$inputpercentpay3','$inputdatepay4','$inputpercentpay4','$inputdatepay5','$inputpercentpay5','$inputdatepay6','$inputpercentpay6','$myCheckBoxID','$System_Session_User_ID','$System_Session_UserName',Now())";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
		$sql = "INSERT INTO ".$myModule_Table2."(".$myModule_Table2."_DateFrom,".$myModule_Table2."_DateTo,".$myModule_Table2."_TimeFrom,".$myModule_Table2."_Subject,".$myModule_Table2."_CreateByID,".$myModule_Table2."_CreateBy,".$myModule_Table2."_CreateDate,".$myModule_Table2."_Status,".$myModule_Table2."_Language,".$myModule_Table2."_GroupID) VALUES('$inputdate','$inputdate','$inputtime','$inputdetail','$System_Session_User_ID','$System_Session_UserName',Now(),'Enable','Thai','6')";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");

	}	
	if($activitystatus=="trackprice")
	{
	$sql = "INSERT INTO ".$myModule_Table1."(".$myModule_Table1."_ID,".$myModule_Table1."_Activitystatus,".$myModule_Table1."_Date,".$myModule_Table1."_Time,".$myModule_Table1."_Detail,".$myModule_Table1."_Total,".$myModule_Table1."_Term,".$myModule_Table1."_Datepay1,".$myModule_Table1."_Percentpay1,".$myModule_Table1."_Datepay2,".$myModule_Table1."_Percentpay2,".$myModule_Table1."_Datepay3,".$myModule_Table1."_Percentpay3,".$myModule_Table1."_Datepay4,".$myModule_Table1."_Percentpay4,".$myModule_Table1."_Datepay5,".$myModule_Table1."_Percentpay5,".$myModule_Table1."_Datepay6,".$myModule_Table1."_Percentpay6,".$myModule_Table1."_Customerid,".$myModule_Table1."_CreateByID,".$myModule_Table1."_CreateBy,".$myModule_Table1."_CreateDate) VALUES('$g','$activitystatus','$inputdate4','$inputtime4','$inputdetail4','$inputtotal','$inputterm','$inputdatepay1','$inputpercentpay1','$inputdatepay2','$inputpercentpay2','$inputdatepay3','$inputpercentpay3','$inputdatepay4','$inputpercentpay4','$inputdatepay5','$inputpercentpay5','$inputdatepay6','$inputpercentpay6','$myCheckBoxID','$System_Session_User_ID','$System_Session_UserName',Now())";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
		$sql = "INSERT INTO ".$myModule_Table2."(".$myModule_Table2."_DateFrom,".$myModule_Table2."_DateTo,".$myModule_Table2."_TimeFrom,".$myModule_Table2."_Subject,".$myModule_Table2."_CreateByID,".$myModule_Table2."_CreateBy,".$myModule_Table2."_CreateDate,".$myModule_Table2."_Status,".$myModule_Table2."_Language,".$myModule_Table2."_GroupID) VALUES('$inputdate','$inputdate','$inputtime','$inputdetail','$System_Session_User_ID','$System_Session_UserName',Now(),'Enable','Thai','7')";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");

	}	
		if($activitystatus=="appoint")
	{
	$sql = "INSERT INTO ".$myModule_Table1."(".$myModule_Table1."_ID,".$myModule_Table1."_Activitystatus,".$myModule_Table1."_Date,".$myModule_Table1."_Time,".$myModule_Table1."_Detail,".$myModule_Table1."_Total,".$myModule_Table1."_Term,".$myModule_Table1."_Datepay1,".$myModule_Table1."_Percentpay1,".$myModule_Table1."_Datepay2,".$myModule_Table1."_Percentpay2,".$myModule_Table1."_Datepay3,".$myModule_Table1."_Percentpay3,".$myModule_Table1."_Datepay4,".$myModule_Table1."_Percentpay4,".$myModule_Table1."_Datepay5,".$myModule_Table1."_Percentpay5,".$myModule_Table1."_Datepay6,".$myModule_Table1."_Percentpay6,".$myModule_Table1."_Customerid,".$myModule_Table1."_CreateByID,".$myModule_Table1."_CreateBy,".$myModule_Table1."_CreateDate) VALUES('$g','$activitystatus','$inputdate5','$inputtime5','$inputdetail5','$inputtotal','$inputterm','$inputdatepay1','$inputpercentpay1','$inputdatepay2','$inputpercentpay2','$inputdatepay3','$inputpercentpay3','$inputdatepay4','$inputpercentpay4','$inputdatepay5','$inputpercentpay5','$inputdatepay6','$inputpercentpay6','$myCheckBoxID','$System_Session_User_ID','$System_Session_UserName',Now())";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
		$sql = "INSERT INTO ".$myModule_Table2."(".$myModule_Table2."_DateFrom,".$myModule_Table2."_DateTo,".$myModule_Table2."_TimeFrom,".$myModule_Table2."_Subject,".$myModule_Table2."_CreateByID,".$myModule_Table2."_CreateBy,".$myModule_Table2."_CreateDate,".$myModule_Table2."_Status,".$myModule_Table2."_Language,".$myModule_Table2."_GroupID) VALUES('$inputdate','$inputdate','$inputtime','$inputdetail','$System_Session_User_ID','$System_Session_UserName',Now(),'Enable','Thai','8')";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");

	}	
		if($activitystatus=="sign")
	{
	$sql = "INSERT INTO ".$myModule_Table1."(".$myModule_Table1."_ID,".$myModule_Table1."_Activitystatus,".$myModule_Table1."_Date,".$myModule_Table1."_Time,".$myModule_Table1."_Detail,".$myModule_Table1."_Total,".$myModule_Table1."_Term,".$myModule_Table1."_Datepay1,".$myModule_Table1."_Percentpay1,".$myModule_Table1."_Datepay2,".$myModule_Table1."_Percentpay2,".$myModule_Table1."_Datepay3,".$myModule_Table1."_Percentpay3,".$myModule_Table1."_Datepay4,".$myModule_Table1."_Percentpay4,".$myModule_Table1."_Datepay5,".$myModule_Table1."_Percentpay5,".$myModule_Table1."_Datepay6,".$myModule_Table1."_Percentpay6,".$myModule_Table1."_Customerid,".$myModule_Table1."_CreateByID,".$myModule_Table1."_CreateBy,".$myModule_Table1."_CreateDate) VALUES('$g','$activitystatus','$inputdate6','$inputtime6','$inputdetail6','$inputtotal','$inputterm','$inputdatepay1','$inputpercentpay1','$inputdatepay2','$inputpercentpay2','$inputdatepay3','$inputpercentpay3','$inputdatepay4','$inputpercentpay4','$inputdatepay5','$inputpercentpay5','$inputdatepay6','$inputpercentpay6','$myCheckBoxID','$System_Session_User_ID','$System_Session_UserName',Now())";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
	$sql = "INSERT INTO ".$myModule_Table2."(".$myModule_Table2."_DateFrom,".$myModule_Table2."_DateTo,".$myModule_Table2."_TimeFrom,".$myModule_Table2."_Subject,".$myModule_Table2."_CreateByID,".$myModule_Table2."_CreateBy,".$myModule_Table2."_CreateDate,".$myModule_Table2."_Status,".$myModule_Table2."_Language,".$myModule_Table2."_GroupID) VALUES('$inputdate','$inputdate','$inputtime','$inputdetail','$System_Session_User_ID','$System_Session_UserName',Now(),'Enable','Thai','9')";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");

	}	
		if($activitystatus=="closesale")
	{
	$sql = "INSERT INTO ".$myModule_Table1."(".$myModule_Table1."_ID,".$myModule_Table1."_Activitystatus,".$myModule_Table1."_Date,".$myModule_Table1."_Time,".$myModule_Table1."_Detail,".$myModule_Table1."_Total,".$myModule_Table1."_Term,".$myModule_Table1."_Datepay1,".$myModule_Table1."_Percentpay1,".$myModule_Table1."_Datepay2,".$myModule_Table1."_Percentpay2,".$myModule_Table1."_Datepay3,".$myModule_Table1."_Percentpay3,".$myModule_Table1."_Datepay4,".$myModule_Table1."_Percentpay4,".$myModule_Table1."_Datepay5,".$myModule_Table1."_Percentpay5,".$myModule_Table1."_Datepay6,".$myModule_Table1."_Percentpay6,".$myModule_Table1."_Customerid,".$myModule_Table1."_CreateByID,".$myModule_Table1."_CreateBy,".$myModule_Table1."_CreateDate) VALUES('$g','$activitystatus','$inputdate6','$inputtime6','$inputdetail6','$inputtotal','$inputterm','$inputdatepay1','$inputpercentpay1','$inputdatepay2','$inputpercentpay2','$inputdatepay3','$inputpercentpay3','$inputdatepay4','$inputpercentpay4','$inputdatepay5','$inputpercentpay5','$inputdatepay6','$inputpercentpay6','$myCheckBoxID','$System_Session_User_ID','$System_Session_UserName',Now())";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
	}	
	if($activitystatus=="uncompletesale")
	{
	$sql = "INSERT INTO ".$myModule_Table1."(".$myModule_Table1."_ID,".$myModule_Table1."_Activitystatus,".$myModule_Table1."_Date,".$myModule_Table1."_Time,".$myModule_Table1."_Detail,".$myModule_Table1."_Total,".$myModule_Table1."_Term,".$myModule_Table1."_Datepay1,".$myModule_Table1."_Percentpay1,".$myModule_Table1."_Datepay2,".$myModule_Table1."_Percentpay2,".$myModule_Table1."_Datepay3,".$myModule_Table1."_Percentpay3,".$myModule_Table1."_Datepay4,".$myModule_Table1."_Percentpay4,".$myModule_Table1."_Datepay5,".$myModule_Table1."_Percentpay5,".$myModule_Table1."_Datepay6,".$myModule_Table1."_Percentpay6,".$myModule_Table1."_Customerid,".$myModule_Table1."_CreateByID,".$myModule_Table1."_CreateBy,".$myModule_Table1."_CreateDate) VALUES('$g','$activitystatus','$inputdate6','$inputtime6','$inputdetail6','$inputtotal','$inputterm','$inputdatepay1','$inputpercentpay1','$inputdatepay2','$inputpercentpay2','$inputdatepay3','$inputpercentpay3','$inputdatepay4','$inputpercentpay4','$inputdatepay5','$inputpercentpay5','$inputdatepay6','$inputpercentpay6','$myCheckBoxID','$System_Session_User_ID','$System_Session_UserName',Now())";

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	}	


	//if($DisplayStyle!="Link"){
				//$sql = "SELECT MAX(".$myModule_Table."_ID) FROM ".$myModule_Table;
				//$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
				//$Row=MYSQL_FETCH_ARRAY($Query);
				//$MaxID = $Row[0];
				
				
			
				srand(make_seed());
				$myrand = rand(1111,9999);
				
				// Check to create module data directory. ---------
					if(!is_dir($System_RelativePath_Upload."/".$SystemModuleKey)) { mkdir($System_RelativePath_Upload."/".$SystemModuleKey,0777); }
					if(!is_dir($myModule_Path_ThumbnailPicture)) { mkdir($myModule_Path_ThumbnailPicture,0777); }
				// ------------------------------------------------
			
					if(isset($_FILES['inputThumbnailPicture'])) {
							if($_FILES['inputThumbnailPicture']['error']==0){				
									$exts = explode(".", $_FILES['inputThumbnailPicture']['name']);
									$ext = strtolower(($exts[count($exts) - 1]));	
									$ImageType = $ext;
									$ThumbnailPictureName = "$MaxID-$myrand.$ImageType";
									if(file_exists($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
											unlink($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName);
									}
									if(move_uploaded_file($_FILES['inputThumbnailPicture']['tmp_name'],$myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
										chmod($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName,0777);
									}
									$sql = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_PictureFile='$ThumbnailPictureName' WHERE ".$myModule_Table."_ID=".$MaxID;
									$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
							}
					}
					/*if(is_file($inputThumbnailPicture)) {
						$ImageData = getimagesize($inputThumbnailPicture);
						if($ImageData!=NULL) {
							if($ImageData[2]==1) { 
								$ImageType="gif";
							} elseif($ImageData[2]==2) {
								$ImageType="jpg";
							}
							$ThumbnailPictureName = "$MaxID-$myrand.$ImageType";
							if(file_exists($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
								unlink($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName);
							}
							if(copy($inputThumbnailPicture,$myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
								chmod($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName,0777);
							}
							$sql = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_PictureFile='$ThumbnailPictureName' WHERE ".$myModule_Table."_ID=".$MaxID;
							$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
						}
						*/
					//}
	//}
?>                    
                    <form action="?" method="post" name="myForm" id="myForm">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                      <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?>">
                    </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
<? }elseif($action=="edit") { 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	$sql="SELECT * FROM cm_listsubject WHERE cm_listsubject_ID='$myCheckBoxID'";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=MYSQL_FETCH_ARRAY($Query);
?>
                    <br>
                    <br>
                    <table style="border-collapse: collapse" border="1" width="95%" align="center" cellpadding="0" cellspacing="1" class="table_border" bordercolor="#E8E7E1">
                      <form action="?" method="post" name="myReturnForm" id="myReturnForm">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                        <input name="action" type="hidden" id="action" value="">
                        <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?>">
                      </form>
                      <form action="?" method="post" name="myForm" id="myForm" enctype="multipart/form-data"  onSubmit=" if(!verifySubmit()) { return false; } ">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                        <input name="action" type="hidden" id="action" value="update">
                        <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="CheckBoxID1" type="hidden" id="CheckBoxID1" value="<?=$myCheckBoxID?>">
                        <input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="1">						
                        <tr> 
                          <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="mytable_inner">
                              
                              <tr align="center"> 
                                <td height="24" colspan="2" align="center" class="table_title2" style="font-weight: bold">แก้ไขข้อมูล</td>
                              </tr>
                              <tr>
                                <td width="236" height="24" align="right" class="table_row2">รายวิชา : </td>
                                <td width="428" class="table_col2"><input name="Subject" type="text" class="input_left" id="Subject" size="40" maxlength="100" value="<?=$Row[cm_listsubject_Name]?>" />
                                    <span style="color: #FF0000">*</span></td>
                              </tr>
                              <tr>
                                <td height="24" align="right" class="table_row2">นักศึกษาที่เรียน : </td>
                                <td class="table_col2"><span class="style3">
                                  <select name="Studentyear" id="Studentyear">
                                    <option value="ปี 1" <? if($Row[cm_listsubject_Studentyear]=="ปี 1"){echo"selected";}?>>ปี 1</option>
                                    <option value="ปี 2" <? if($Row[cm_listsubject_Studentyear]=="ปี 2"){echo"selected";}?>>ปี 2</option>
                                    <option value="ปี 3" <? if($Row[cm_listsubject_Studentyear]=="ปี 3"){echo"selected";}?>>ปี 3</option>
                                    <option value="ปี 4" <? if($Row[cm_listsubject_Studentyear]=="ปี 4"){echo"selected";}?>>ปี 4</option>
                                    <option value="ปี 5" <? if($Row[cm_listsubject_Studentyear]=="ปี 5"){echo"selected";}?>>ปี 5</option>
                                    <option value="ปี 6" <? if($Row[cm_listsubject_Studentyear]=="ปี 6"){echo"selected";}?>>ปี 6</option>
                                  </select>
                                </span></td>
                              </tr>
                              
							  														    
                            </table>
                            <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                              <tr align="right"> 
                                <td height="30" colspan="4" align="center" class="table_row2"> 
                                  <table width="300" border="0" cellspacing="0" cellpadding="2">
                                    <tr align="center"> 
                                      <td>
<script language="JavaScript" type="text/JavaScript">
function isBlank(myObj) { if(myObj.value=='') { return true; } return false; }
function verifySubmit() {
	with(document.myForm) {
 <? if($DisplayStyle!="Picture"){?>
		if(inputName.value=='') {
			inputName.focus();
			return false;
		}
 <? }?>
 <? if($DisplayStyle!="Link"){?>
		myfile = inputThumbnailPicture.value;
		if(myfile!='') {
			myfile = myfile.toLowerCase();
			Temp = myfile.charAt(myfile.length-4) + myfile.charAt(myfile.length-3) + myfile.charAt(myfile.length-2) + myfile.charAt(myfile.length-1);
			if(Temp=='.jpg' || Temp=='.gif' || Temp=='jpeg') {
				document.getElementById('PreviewImage').src=myfile;
				document.getElementById('PreviewImageText').innerHTML= document.getElementById('PreviewImage').width + 'x' + document.getElementById('PreviewImage').height + ' pixel';
			} else {
				alert('System allow to upload image files only.');
				document.myForm.inputThumbnailPicture.focus();
				return false; 
			}
		}
<? }?>
		if(inputURL.value=='') {
			inputURL.focus();
			return false;
		}		
	}
	return true;
}
						</script> <input name="btSave" type="submit" class="button_60" id="btSave" value="บันทึก">                                      </td>
                                      <td> <input name="btCalcel" type="button" class="button_60" id="btCalcel" onClick="
if(confirm('Are you sure to return to list?')) {
	document.myReturnForm.submit();
}
						" value="ย้อนกลับ"> </td>
                                    </tr>
                                  </table></td>
                              </tr>
                            </table></td>
                        </tr>
                      </form>
                    </table>
<? 
##############################################
 }elseif($action=="view") { 
 $CheckBoxID=$_GET["CheckBoxID"];
 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	//$sql = "SELECT * FROM crm_mod_customer p,crm_mod_customer_history t WHERE p.crm_mod_customer_ID  = crm_mod_customer_history_ID  AND p.crm_mod_customer_ID=".$myCheckBoxID;
 $sql="SELECT * FROM roadpump_typepump WHERE roadpump_typepump_ID='$myCheckBoxID'";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=MYSQL_FETCH_ARRAY($Query);
?>
                    <br>
                    <br>
                    <br />
                    <table style="border-collapse: collapse" border="1" bordercolor="#E8E7E1" width="95%" align="center" cellpadding="0" cellspacing="1" class="table_border">
                      <form action="?" method="post" name="myReturnForm" id="myReturnForm">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="admin" type="hidden" id="admin" value="<?=$admin?>">

                        <input name="action" type="hidden" id="action" value="">
                        <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?>">
                      </form>
                      <form action="?" method="post" name="myForm" id="myForm" >
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                        <input name="action" type="hidden" id="action" value="update">
                        <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="CheckBoxID1" type="hidden" id="CheckBoxID1" value="<?=$myCheckBoxID?>">
                        <input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="1">						
                        <tr> 
                          <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="mytable_inner">
                              
                              <tr align="center"> 
                                <td height="24" colspan="3" align="center" class="table_title2" style="font-weight: bold">ดูข้อมูล</td>
                              </tr>
                              <tr>
                                <td width="228" height="31" align="right" class="table_row2">แพทยภา : </td> 
                                <td width="460" colspan="2" class="table_row2"><?=$Row[roadpump_typepump_Name]?></td>
                              </tr>
                              														    
                            </table>
                            <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                              <tr align="right"> 
                                <td height="30" colspan="4" align="center" class="table_row2"> 
                                  <table width="300" border="0" cellspacing="0" cellpadding="2">
                                    <tr align="center"> 
 <? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>                                  
								      <td>
 <input name="btEdit" type="submit" class="button_80" id="btEdit" value="แก้ไขข้อมูล" onClick="
document.myForm.action.value='edit';
document.myForm.submit();
						">                                      </td>
<? }?>						
                                      <td> <input name="btCalcel" type="button" class="button_80" id="btCalcel" onClick="
if(confirm('Are you sure to return to list?')) {
	document.myReturnForm.submit();
}
						" value="ย้อนกลับ"> </td>
                                    </tr>
                                  </table></td>
                              </tr>
                            </table></td>
                        </tr>
                      </form>
                    </table>
					</form>
                    <br />
					<? 
//########################################################
} else if ($action=="update") { 
	$MaxID = $CheckBoxID1;
	$sql = "UPDATE cm_listsubject SET cm_listsubject_Name='$Subject',cm_listsubject_Studentyear='$Studentyear' WHERE cm_listsubject_ID='$CheckBoxID1'";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
?>
<form action="?" method="post" name="myForm" id="myForm">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <input name="admin" type="hidden" id="admin" value="<?=$admin?>">
                      <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?>">
                    </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
 <? 
#########################################################
}elseif ($action=="delete") { 
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			
			$sql = "DELETE FROM cm_listsubject WHERE cm_listsubject_ID=".$$myVar;
			$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
		}
	}
?>
                    <form action="?" method="post" name="myForm" id="myForm">
                      <input name="action" type="hidden" id="action">
                      <input name="GroupID" type="hidden" id="GroupID" value="<?=$GroupID?>">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <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?>">
                    </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
                    <? 
#########################################################
} else if ($action=="setstatus") { 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	$sql="UPDATE ".$myModule_Table." SET ".$myModule_Table."_Status='$SelectStatus' WHERE ".$myModule_Table."_ID=".$myCheckBoxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
?>
                    <form action="?" method="post" name="myForm" id="myForm">
                      <input name="action" type="hidden" id="action">
                      <input name="GroupID" type="hidden" id="GroupID" value="<?=$GroupID?>">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <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?>">
                    </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
                    <?	
#########################################################
} else { ?>
<?
# 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($GroupID=="") { $GroupID=0; }

# Count total record size #########################
$sql = "SELECT * FROM cm_listsubject where cm_listsubject_Staffid='$System_Session_User_ID' OR cm_listsubject_Staffid1='$System_Session_User_ID'";
$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("<br><br><b><font color=#FF0000>ไม่สามารถใช้งานระบบได้<br>หากคุณเข้าใช้งานเป็นครั้งแรก<br><a href=\"#\" onClick=\"Popup('popupCreateDatabaseWindow','createdatabase.php',220,180,1);\">กรุณาคลิ๊กที่นี่</a><br>เพื่อทำการสร้างฐานข้อมูลใหม่</font></b>\n");
if($PageSearch=="") {
$sql = "SELECT * FROM cm_listsubject where cm_listsubject_Staffid='$System_Session_User_ID' OR cm_listsubject_Staffid1='$System_Session_User_ID'";
	} else {
		$sql = $sql."  WHERE  (cm_listsubject_Name LIKE '%$PageSearch%') ";
}

$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("<br><br><b><font color=#FF0000>ไม่สามารถใช้งานระบบได้<br>หากคุณเข้าใช้งานเป็นครั้งแรก<br><a href=\"#\" onClick=\"Popup('popupCreateDatabaseWindow','createdatabase.php',220,180,1);\">กรุณาคลิ๊กที่นี่</a><br>เพื่อทำการสร้างฐานข้อมูลใหม่</font></b>\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;

$sql.=" ORDER BY cm_listsubject_Name ASC LIMIT $RecordStart , $PageSize";
$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
$RecordCount=MYSQL_NUMROWS($Query);
?>
                    <script language="JavaScript" type="text/JavaScript">
function Paging_CheckAll(objCheckHeader,txtCheckBoxFirstName,intTotalItems) {
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			document.getElementById(txtCheckBoxFirstName+i).checked = objCheckHeader.checked;			
	return true;

}
function Paging_CheckAllHandle(objCheckHeader,txtCheckBoxFirstName,intTotalItems) {
	var isCheckedAll = true;
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			if(!document.getElementById(txtCheckBoxFirstName+i).checked) 
			isCheckedAll = false;
	objCheckHeader.checked = isCheckedAll;
	return true;
}
function Paging_CountChecked(txtCheckBoxFirstName,intTotalItems) {
	var intChecked = 0;
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			if(document.getElementById(txtCheckBoxFirstName+i).checked) 
			intChecked ++;
	return intChecked ;
}
function Paging_CheckedThisItem(objCheckHeader,indexing,txtCheckBoxFirstName,intTotalItems) {
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			if(i==indexing) {
				document.getElementById(txtCheckBoxFirstName+i).checked = true;
			} else {
				document.getElementById(txtCheckBoxFirstName+i).checked = false;
			}
	objCheckHeader.checked = false;
	return true;
}
</script>
                    <div id="divDataPicker" style="display:none; position:absolute; top:-135px; left:81px; width: 200px; z-index: 1;Filter:Alpha(opacity=95)"> 
                      <table width="100%" border="0" cellpadding="0" cellspacing="1" class="table_border">
                        <form action="?" method="post" name="myStatusForm" id="myStatusForm">
                          <input name="GroupID" type="hidden" id="GroupID" value="<?=$GroupID?>">
                          <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                          <tr> 
                            <td height="22"><table width="100%" height="22" border="0" cellpadding="0" cellspacing="0" class="table_header">
                                <tr> 
                                  <td width="28" align="center"><img src="../images/icon/ico439.gif" width="19" height="15"></td>
                                  <td align="center">Select Status</td>
                                  <td width="22" align="center"><img src="../images/icon/ico215.gif" width="16" height="16" onMouseOver="this.style.cursor='hand'" onClick="document.getElementById('divDataPicker').style.display='none'; "></td>
                                </tr>
                              </table></td>
                          </tr>
                          <tr> 
                            <td height="120" align="center" class="table_row1"><br> 
                              <table width="120" border="0" cellpadding="2" cellspacing="0">
                                <tr> 
                                  <td height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="Enable"></td>
                                  <td height="22" class="text_bold">Enable</td>
                                </tr>
                                <tr> 
                                  <td width="26" height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="Disable"></td>
                                  <td height="22" class="text_bold">Disable</td>
                                </tr>
                              </table>
                              <br> <table border="0" cellspacing="0" cellpadding="6">
                                <tr> 
                                  <td><input name="btSave" type="button" class="button_th_60" id="btSave" value="Save" onClick="
if(document.myStatusForm.toolbarStatus[0].checked) {
	document.myForm.SelectStatus.value=document.myStatusForm.toolbarStatus[0].value;
}
if(document.myStatusForm.toolbarStatus[1].checked) {
	document.myForm.SelectStatus.value=document.myStatusForm.toolbarStatus[1].value;
}
document.myForm.action.value='setstatus';
Paging_CheckedThisItem(document.myForm.CheckBoxAll, StatusIndex ,'CheckBoxID', document.myForm.TotalCheckBoxID.value );
document.myForm.submit();
"></td>
                                  <td><input name="btClose" type="button" class="button_th_60" id="btClose" value="Close" onClick="document.getElementById('divDataPicker').style.display='none';"></td>
                                </tr>
                              </table></td>
                          </tr>
                          <tr> 
                            <td height="6" class="table_footer"><img src="../images/blank.gif" width="1" height="1"></td>
                          </tr>
                        </form>
                      </table>
                    </div>
                    <script language="JavaScript" type="text/JavaScript">
var StatusIndex=0;
function ShowDataPicker(myDivName,RefX,RefY) {
	document.getElementById(myDivName).style.display=''; 
	document.getElementById(myDivName).style.left = document.body.scrollLeft + window.event.clientX + RefX;
	document.getElementById(myDivName).style.top= document.body.scrollTop+ window.event.clientY + RefY;
}
	  </script>
                    <table width="95%" border="0" align="center" cellpadding="2" cellspacing="0" >
                  <form action="" method="post" name="mySearchForm1" id="mySearchForm1" onsubmit="return false;">
                    <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>" />
                    <input name="SystemMenuID2" type="hidden" id="SystemMenuID2" value="<?=$SystemMenuID?>" />
                    <tr>
                      <td>
                        
                        <div align="right">
                          <input name="toolbarPageSearch1" type="text"  style="height:15px"class="input_left" id="toolbarPageSearch1" value="<?=$PageSearch?>" size="20" maxlength="50" />                        
                          <input name="btPageSearch" type="button" class="button_60" id="btPageSearch" value="ค้นหาข้อมูล" onclick="
document.myForm.PageSearch.value=document.mySearchForm1.toolbarPageSearch1.value;
document.myForm.submit();
						" />
                          <input name="btAdd2" type="button" class="button_80" id="btAdd2" value="เพิ่มข้อมูลใหม่" onclick="
document.myForm.action.value='add';
document.myForm.submit();
				" />
                      </div></td></tr>
                  </form>
                </table>
                    <br />
                    <table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="table_border">
                      <tr> 
                        <td bgcolor="#FFFFFF">  <table style="border-collapse: collapse" border="1" width="98%" align="center" cellpadding="0" cellspacing="1" class="table_border" bordercolor="#E8E7E1">
                            <form action="?" method="post" name="myForm" id="myForm">
                              <input name="GroupID" type="hidden" id="GroupID" value="<?=$GroupID?>">
                              <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                              <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                              <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="menu_table_header">
                                <td height="24" colspan="6" bgcolor="#F7F6F0" class="table_title1"><div align="left">ข้อมูลรายวิชา</div></td>
                                </tr>
                              <tr align="center" class="menu_table_header"> 
                                <td width="59" height="24" bgcolor="#F7F6F0" class="table_title2"><input name="CheckBoxAll" type="checkbox" class="form_checkbox" id="CheckBoxAll" value="Yes" onClick="Paging_CheckAll(this,'CheckBoxID',document.myForm.TotalCheckBoxID.value)"></td>
                                <td width="59" height="24" align="center" bgcolor="#F7F6F0" class="table_title2">No.</td>
					<? if($DisplayStyle!="Link"){?>
                                <? }?>
                                <td width="179" height="24" bgcolor="#F7F6F0" class="table_title2">รายวิชา</td>
                                
                                <td width="96" bgcolor="#F7F6F0" class="table_title2">นักศึกษาที่เรียน</td>
                                <td width="122" height="24" bgcolor="#F7F6F0" class="table_title2">วันที่เพิ่ม</td>
                                <td width="129" height="24" bgcolor="#F7F6F0" class="table_title2">Action</td>
                              </tr>
                              <?
$index=1;
if($RecordCount>0) {
	while($index<$RecordCount+1) {
		if($myClassRow=="table_row1") { $myClassRow="table_row2"; } else { $myClassRow="table_row1";  }
		$Row=MYSQL_FETCH_ARRAY($Query);
	?>
                              <tr class="<?=$myClassRow?>"> 
                                <td width="59" height="30" align="center"> <input name="CheckBoxID<?=$index?>" type="checkbox" class="form_checkbox" id="CheckBoxID<?=$index?>" onClick="Paging_CheckAllHandle(document.myForm.CheckBoxAll,'CheckBoxID',document.myForm.TotalCheckBoxID.value)" value="<?=$Row[cm_listsubject_ID]?>"></td>
                                <td width="59" height="30" align="center"> 
                                  <? if($ASCDESC=="DESC") { echo $RecordStart+$index; } else { echo ($TotalRecordCount-($RecordStart+$index)+1); } ?></td>
							
								<td height="30"> 
                                  <div align="center"><strong>
                                  <span class="menu_one">
                                    <a href="../system/mod_dataoverall/indexadmin.php?listid=<?=$Row[cm_listsubject_ID]?>&subject=<?=$Row[cm_listsubject_Name]?>&studentyear=<?=$Row[cm_listsubject_Studentyear]?>"><?=$Row[cm_listsubject_Name]?></a></span>
                                  </strong></div></td>
                                
                                <td height="30"><div align="center"><strong>
                                  <?=$Row[cm_listsubject_Studentyear]?>
                                </strong></div></td>
                                <td width="122" height="30" align="center"> 
                                  <div align="center">
                                   <? $sql="select * from cm_mod_detailoverall where cm_mod_detailoverall_ListsubjectID='$Row[cm_listsubject_ID]'";
								   $query-mysql_query($sql);
								   echo $num=mysql_num_rows($query);                                
								   ?>
                                  </div></td>
                                <td width="129" height="30" align="center" valign="middle"> 
                                  <table border="0" cellspacing="0" cellpadding="1">
                                    <tr align="center" valign="bottom">
<td>
<img src="../img/icons/edit.png" alt="แก้ไขข้อมูล" width="16" height="16" border="0" onMouseOver="this.style.cursor='hand'" onClick="
if(confirm('Are you sure to edit this record?')) {
	Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
	document.myForm.action.value='edit';
	document.myForm.submit();
}
						"></td>									
									  <td style="display:none"> <img src="../img/icons/delete.png" alt="ลบข้อมูล" width="16" height="16" border="0" onMouseOver="this.style.cursor='hand'" onClick="
if(confirm('Are you sure to delete this record?')) {
	Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
	document.myForm.action.value='delete';
	document.myForm.submit();
}
						"></td>
                        <td>
                        <img src="../img/icons/page_add.png" alt="เพิ่มข้อมูลวัน/เวลา" width="16" height="16" border="0" onMouseOver="this.style.cursor='hand'" onClick="window.location='../system/mod_dataoverall/indexadmin.php?listid=<?=$Row[cm_listsubject_ID]?>&subject=<?=$Row[cm_listsubject_Name]?>&studentyear=<?=$Row[cm_listsubject_Studentyear]?>'">
                        </td>
                                    </tr>
                                </table></td>
                              </tr>
                              <?
		$index++;
	}
} else {  ?>
                              <tr class="table_row1"> 
                                <td height="80" colspan="8" align="center"> ไม่พบข้อมูล!</td>
                              </tr>
                              <? } ?>
                              <input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="<?=$index-1?>">
                            </form>
                          </table>
                          <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                            <form action="?" method="post" name="mySearchForm" id="mySearchForm" onSubmit="return false;">
                              <input name="GroupID" type="hidden" id="GroupID" value="<?=$GroupID?>">
                              <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                              <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                              <tr align="right"> 
                                <td colspan="4" align="right" class="table_footer"><div class="menu_one"> 
                                  <div align="left">หน้า
                                    <? 
				  if($NoOfPage>1) { 
				  ?>
                                    <select name="toolbarPageShow" class="select" onchange="document.myForm.PageShow.value=this.value; document.myForm.submit(); ">
                                      <? 
if($NoOfPage<$SystemModule_MaxPage) {
	// Show page list #########################
	for($i=1;$i<=$NoOfPage;$i++) { 
		echo "<option value=\"$i\"";
		if($i==$PageShow) { echo " selected"; }
		echo ">$i</option>";
	} 
}  else {
	// # If total page count greater than default max page  value then reduce page select size #########################
	$starti = $PageShow-$SystemModule_ReduceRange;
	if($starti<1) { $starti=1; }
	$endi = $PageShow+$SystemModule_ReduceRange;
	if($endi>$NoOfPage) { $endi=$NoOfPage; }
	//#####################
	for($i=$starti ;$i<=$endi;$i++) { 
		echo "<option value=\"$i\"";
		if($i==$PageShow) { echo " selected"; }
		echo ">$i</option>";
	} 
}
?>
                                    </select>
                                    <? 
 } else { 
	echo "1";
 }
 ?>
จาก
<?=$NoOfPage?>
 | ค้นพบทั้งหมด
 <?=$TotalRecordCount?>
 รายการ</div>
                                </div></td>
                              </tr>
                            </form>
                          </table></td>
                      </tr>
                    </table>
                    <br>
                    <? 
}
#########################################################
?>
                    
                    <p>&nbsp; </p>
                    <p align="right">&nbsp;</p>
    	          </div>
                  <? } }?>
                  </td>
        <td width="17" valign="top" background="../images/object/border_07.gif"><img src="../images/object/border_17.gif" width="17" height="119"></td>
      </tr>
      <tr>
        <td height="16"><img src="../images/object/border_09.gif" width="20" height="16"></td>
        <td height="16" background="../images/object/border_11.gif"><img src="../images/object/border_11.gif" width="1" height="16"></td>
        <td><img src="../images/object/border_13.gif" width="17" height="16"></td>
      </tr>
    </table></td>
        </tr>
      </table></td>
    <td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td> 
  </tr>
</table>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="4" height="3" align="center" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td height="3" align="center" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td width="4" height="3" align="center" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
  </tr>
  <tr> 
    <td width="4" height="30" align="left" valign="bottom" background="../../images/main/main-t-bg.gif">&nbsp;</td>
    <td height="30" align="center" background="../../images/main/main-t-bg.gif">&nbsp;</td>
    <td width="4" height="30" align="right" valign="bottom" background="../../images/main/main-t-bg.gif">&nbsp;</td>
  </tr>
</table>
</body>
</html>
<? 
include("../lib/disconnect.php");
?>

Hacked By AnonymousFox1.0, Coded By AnonymousFox