Viewing file: ProplanStrateg.php (9.08 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
session_start();
/** Define Validate Access */
define( '_VALID_ACCESS', 1 );
/** Check Session User Login */
if( !session_is_registered("valid_user") && !session_is_registered("Priority") ) {
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-874\" />";
echo "<p style=padding-top:115px><p align=center><br /><font color=red><strong>กรุณาทำการ Login ก่อน</strong></font></p></p>";
echo "<meta http-equiv=\"refresh\" content=\"1; URL=../login.php\" />";
exit();
}
else {
/** Configuration */
require_once( "../configuration.php" );
require_once( $_Config_absolute_path . "/includes/framework.php" );
require_once( "../includes/Function.php" );
/** Create Database Object */
$dbObj = new DBConn;
//=== SESSION
$Username = $valid_user;
/** Config Table for This Page */
$myTable = "prostrategymap_tb";
$myTable1 = "projstrategy_tb";
$myTable2 ="projectstra_type_tb";
$myTable3 ="proplanstrateg_tb" ;
$myTable2PK = "StaplanId";
$myOrderBy = "Noplan";
/** Paging */
$page = $_GET['page'];
if( $page == "" ) { $page = 1; }
/** จำนวนข้อมูล ต่อ 1 หน้า */
$perpage = $_REQUEST['perpage'];
if( $perpage == "" ) { $perpage = 50; }
/** Botton Name Action */
$action = $_REQUEST['action'];
$id = $_REQUEST['id'];
if( isset($action) && !empty($action) ) {
switch($action) {
case "Update" :
$num = count($id);
//for( $i=0; $i<$num; $i++ ) {
$query2 = " SELECT StratempId , StaplanId ,Budget_Year FROM $myTable3 WHERE StaplanId='$StaplanId' ";
$result2 = mysql_query($query2);
$query3 = " SELECT * FROM $myTable2 WHERE ProjectId='$ProjectId' ";
$result3 = mysql_query($query3);
$rows = mysql_num_rows($result3);
$data = mysql_fetch_array($result3);
if($rows) $queryUp = "UPDATE projectstra_type_tb SET StratempId='$StratempId' , ProjectId='$ProjectId' , StaplanId='$StaplanId', AcademicYear='$AcademicYear' , Budget_Year='$Budget_Year' WHERE ProstrId = '$data[ProstrId]' " ;
else $queryUp = " INSERT INTO projectstra_type_tb ( StratempId , ProjectId, StaplanId, AcademicYear,Budget_Year )
VALUES( '$StratempId' , '$ProjectId' , '$StaplanId', '$AcademicYear' , '$Budget_Year' ) ";
mysql_query($queryUp);
$query = " UPDATE project_type_tb SET StaplanId='$StaplanId' WHERE ProjectId ='$ProjectId' ";
mysql_query($query);
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-874\" />";
echo "<script>alert('บันทึกข้อมูลเรียบร้อยแล้ว');</script>";
echo "<script>window.opener.document.all.myForm; window.opener.location.reload(); window.close();</script>";
exit();
//}
break;
} # switch
} # if
} # else
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<link href="../css/default.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="../js/utilities.js"></script>
<!---------------------------------------Begin JavaScript---------------------------------------->
<title>ข้อมูลทั่วไปบุคลากร - ข้อมูลการแผนดำเนินการ - แผนดำเนินการรายปี</title>
</head>
<body topmargin="0" rightmargin="0" bottommargin="0" leftmargin="0">
<table width="812" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="800" height="309" align="center" valign="top" style="padding:10px 0px 5px 10px">
<?php
/** Config Paging */
if( $perpage == "" ) { $limit = $_Config_limit; }
else { $limit = $perpage; }
$scroll = $_Config_scroll;
/** ตั้งค่า Default สำหรับการทำ Order By */
if( $OrderBy == "" ) { $OrderBy = $myTable2PK; }
if( !isset($_GET['ASCDESC']) ) { $ASCDESC = "ASC"; }
if( $_GET['ASCDESC'] == "DESC" ) { $ASCDESC = "ASC"; }
elseif( $_GET['ASCDESC'] == "ASC" ) { $ASCDESC = "DESC"; }
/** Query เพื่อหา Numrows ก่อน */
$query = " SELECT * FROM $myTable WHERE StratempId ='$StratempId' ";
$result = $dbObj->execQuery($query);
$numrows = $dbObj->_numrows;
/** Paging */
$display = ( !isset ($_GET['page']) ) ? 1 : $_GET['page'];
$start = ( ($display * $limit) - $limit );
/** Paging */
if( isset($_GET['OrderBy']) ) {
$query = " SELECT * FROM $myTable3 WHERE StratempId ='$StratempId' ORDER BY $OrderBy $ASCDESC ";
}
elseif( !isset($_GET['OrderBy']) ) {
$query = " SELECT * FROM $myTable3 WHERE StratempId ='$StratempId' ORDER BY $myTable2PK ASC ";
}
$query .= " LIMIT $start, $limit ";
$result = $dbObj->execQuery($query);
?>
<fieldset>
<table width="780" border="0" cellspacing="0" cellpadding="0">
<form id="myForm" name="myForm" method="post" action="<?=$PHP_SELF;?>">
<tr>
<td width="780" height="5" colspan="2"></td>
</tr>
<tr>
<td colspan="2"><span class="PADDING-TOP-10 PADDING-BOTTOM-10"><img src="../images/icons/arrow-circle-225-left.png" width="16" height="16" border="0" align="absmiddle" /> <a href="javascript:;" onclick="window.history.back();"><strong>‹ ย้อนกลับ</strong></a></span></td>
</tr>
<tr>
<td colspan="2" align="center"> </td>
</tr>
<tr>
<td colspan="2" align="center"><div align="left"></div></td>
</tr>
<tr>
<td colspan="2" align="center">
<?php if( $numrows > 0 ) { ?>
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="250" align="left" class="TEXT-CLIMSON10" style="padding-bottom:5px;">ทั้งหมด: <strong><?=$numrows;?></strong> รายการ</td>
<td width="510" align="right" style="padding-bottom:5px;"> </td>
</tr>
</table>
<table width="745" border="0" align="center" cellpadding="0" cellspacing="0" class="BORDER-GREY">
<tr bgcolor="#F8F8F8">
<td width="636" height="25" align="left" class="PADDING-LEFT-5 BORDER">กลยุทธ์ที่ </a>
<?=$rss['Nocode'];?>
</a>
<?=htmlspecialchars_decode( nl2br( $rss['Strategyname'] ) );?></td>
<td width="61" align="center" class="BORDER-LEFT"><span style="padding-bottom:5px;">
<input type="submit" name="action" id="action" value="Update" class="TEXT-CLIMSON10 CURSOR-HAND WIDTH60" />
</span></td>
<td width="46" align="center" class="BORDER-LEFT"><input name="checkboxall" type="checkbox" id="checkboxall" onclick="checkAllUpdate(this,this.form);" value="checkbox" alt="เลือกทั้งหมด " title=" เลือก/ไม่เลือก ทั้งหมด " disabled /></td>
</tr>
<?php
$no = 1+($display-1)*$limit;
while( $rs = $dbObj->fetchArray($result) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
?>
<tr bgcolor="<?=$bgColor;?>" onmouseover="this.style.backgroundColor='#F5F9F9'" onmouseout="this.style.backgroundColor=''">
<td height="23" colspan="2" align="left" class="PADDING-LEFT-15 BORDER-TOP">กลวิธีที่.
<?=$rs['Noplan'];?> <?=$rs['PlanStaName'];?>
</a></td>
<td align="center" class="BORDER-TOP BORDER-LEFT">
<?
$query5 = " SELECT * FROM projectstra_type_tb WHERE ProjectId='$ProjectId' and StaplanId = '$rs[StaplanId]' ";
$result5 = mysql_query($query5);
$checkData = mysql_num_rows($result5);
?>
<input type="radio" name="StaplanId" value="<?=$rs['StaplanId'];?>" onclick="highlightRow(this);" title=" บันทึกข้อมูล <?php echo $rs['StaplanId']; ?>&<?
$query = " SELECT * FROM project_type_tb WHERE ProjectId='$ProjectId' ";
$result1 = $dbObj->execQuery($query);
$rs2 = $dbObj->fetchArray($result1);
echo $rs2['ProjectId'];?>" <?=($checkData)?"disabled":"";?> />
<input name="ProjectId" type="hidden" id="ProjectId" value="<? echo $rs2[ProjectId]?>" />
<input name="StratempId" type="hidden" id="StratempId" value="<? echo $rs[StratempId]?>" />
<input name="Budget_Year" type="hidden" id="Budget_Year" value="<? echo $rs[Budget_Year]?>" /></td>
</tr>
<?php
$no++;
} # while
$dbObj->freeresult($result);
?>
</table>
<?php } #if ?></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr></form>
</table>
</fieldset></td>
</tr>
</table>
</body>
</html>
<?php
/** Free Resource */
$dbObj->freeresult($result1);
/** Close the Database */
$dbObj->disconn();
/** Unset Class */
unset($dbObj);
?>
|