Viewing file: PlanProjectDetail.php (12.12 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/** Define Validate Access */
define( '_VALID_ACCESS', 1 );
/** Configuration */
require_once( "../configuration.php" );
require_once( $_Config_absolute_path . "/includes/framework.php" );
require_once( "../includes/Function.php" );
/** Create Database Object */
$dbObj = new DBConn;
/** Config Table for This Page */
$myTable = "project_type_tb";
$myTableFK = "Orderlist";
/** Parameters */
//$params = "Budget_Year=$Budget_Year&Flag1=$Flag1";
/** Paging */
$page = $_GET['page'];
if( $page == "" ) { $page = 1; }
/** จำนวนข้อมูล ต่อ 1 หน้า */
$perpage = $_REQUEST['perpage'];
if( $perpage == "" ) { $perpage = 5; }
//=== project_type_tb //
$sql = " SELECT * FROM $myTable Where Budget_Year='$Budget_Year' and Flag1='Y' ORDER BY Orderlist ASC ";
$result = $dbObj->execQuery($sql);
$rs = $dbObj->fetchArray($result);
$num = $dbObj->_numrows;
?>
<html>
<head>
<title>Information Detail</title>
<link href="../css/default.css" rel="stylesheet" type="text/css" />
<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>
<SCRIPT LANGUAGE="JavaScript" src="../source/script.js"></SCRIPT>
<script language="JavaScript">
function ReturnValue(ProjectId,Project_plan,Budget_Year,Budget_use,Orderlist_2,Faculty_code)
{
window.opener.document.pc.ProjectId.value = ProjectId;
window.opener.document.pc.Project_name.value = Project_plan;
window.opener.document.pc.Year_budget.value = Budget_Year;
window.opener.document.pc.Budget_use.value = Budget_use;
window.opener.document.pc.Objective.value = Orderlist_2;
window.opener.document.pc.Faculty_code.value = Faculty_code;
window.close();
}
</script>
<body>
<table width="635" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10"><span 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 = $myTableFK; }
if( !isset($_GET['ASCDESC']) ) { $ASCDESC = "DESC"; }
if( $_GET['ASCDESC'] == "DESC" ) { $ASCDESC = "ASC"; }
elseif( $_GET['ASCDESC'] == "ASC" ) { $ASCDESC = "DESC"; }
/** Query เพื่อหา Numrows ก่อน */
$query = " SELECT * FROM $myTable Where Budget_Year='$Budget_Year' and Flag1='Y' ORDER BY $myTableFK DESC ";
$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 $myTable Where Budget_Year='$Budget_Year' and Flag1='Y' ORDER BY $OrderBy $ASCDESC ";
}
elseif( !isset($_GET['OrderBy']) ) {
$query = " SELECT * FROM $myTable Where Budget_Year='$Budget_Year' and Flag1='Y' ORDER BY $myTableFK DESC ";
}
$query .= " LIMIT $start, $limit ";
$result = $dbObj->execQuery($query);
?>
</span></td>
</tr>
</table>
<table width="751" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th width="751" align="center" scope="col">
<form id="pc" name="pc" method="post" action="<? echo $PHP_SELF;?>?page=<?=$page;?>&<?=$param;?>">
<fieldset>
<table width="770" border="0" cellspacing="0" cellpadding="0">
<tr>
</tr>
<tr>
</tr>
<tr>
<td align="center" valign="top"><table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="74%" align="left" style="padding-bottom:5px;">ทั้งหมด: <span class="NOTE"><strong>
<?=number_format($numrows);?>
</strong></span> รายการ</td>
<td width="26%" align="right" style="padding-bottom:5px;">จำนวนข้อมูลต่อหน้า
<select name="perpage" id="perpage" onchange="document.myForm.perpage.value=this.value; document.myForm.submit();" style="font-size:9pt; color:darkblue">
<option value="5" <?php if( $perpage=="5" ) echo 'selected'; ?>>5</option>
<option value="10" <?php if( $perpage=="10" ) echo 'selected'; ?>>10</option>
<option value="20" <?php if( $perpage=="20" ) echo 'selected'; ?>>20</option>
<option value="50" <?php if( $perpage=="50" ) echo 'selected'; ?>>50</option>
</select></td>
</tr>
<tr>
<td colspan="2" align="right" style="padding-bottom:5px;"> </td>
</tr>
</table>
<?php if( $numrows > 0 ) { ?>
<table width="748" border="0" align="center" cellpadding="0" cellspacing="0" class="BORDER-GREY">
<tr bgcolor="#F0F0F0">
<td width="33" height="25" align="center"><strong>No</strong></td>
<td width="407" align="center" class="BORDER-LEFT-RIGHT"><strong>ชื่อโครงการ</strong></td>
<td width="145" align="center"><strong>หน่วยงาน</strong></td>
<td width="78" align="center" class="BORDER-LEFT-RIGHT"><strong>หมวดเงิน</strong></td>
<td width="83" align="center"><strong>งบประมาณ</strong></td>
</tr>
<?php
$no = 1+($display-1)*$limit;
while( $row= $dbObj->fetchArray($result) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
// $programId = $rs['programId'];
?>
<tr bgcolor="<?=$bgColor;?>" onmouseover="this.style.backgroundColor='#F5F9F9'" onmouseout="this.style.backgroundColor=''">
<td height="23" align="center" class="BORDER-TOP"><font color="#996600" size="2" face="Tahoma"><a href="#"><font size="2" face="Tahoma">
<?=$row["Orderlist"]?>
</font></a></font></td>
<td align="left" class="PADDING-LEFT-3 PADDING-RIGHT-3 BORDER-TOP-LEFT-RIGHT"onclick='ReturnValue("<?php echo $row["ProjectId"]?>","<?php echo $row["Project_plan"]?>","<?php echo $row["Budget_Year"]?>"," <?=$row["Budget_use"]?>"," <?=$row["Orderlist_2"]?>","<? echo $row["Faculty_code"]?>")'><a href="#" >
<?=$row["Project_plan"]?>
</a></td>
<td align="right" class="BORDER-TOP PADDING-RIGHT-5"><span class="PADDING-LEFT-5"><font color="#000000" size="2" face="Tahoma">
<?php
$Faculty_code = $row[Faculty_code];
$sql4 = "Select * From faculty_tb Where Faculty_code='$Faculty_code'";
$result4 = mysql_query($sql4) or die("Error".mysql_error());
$rs4 = mysql_fetch_array($result4);
echo" $rs4[Faculty_name]";
?>
</font></span></td>
<td align="center" class="BORDER-TOP BORDER-LEFT-RIGHT"><span class="PADDING-LEFT-5"><font color="#000000" size="2" face="Tahoma">
<?php
$MoneyS_C = $row[MoneyS_C];
$sql3 = "Select * From money_source_tb Where MoneyS_C='$MoneyS_C'";
$result3 = mysql_query($sql3) or die("Error".mysql_error());
$rss = mysql_fetch_array($result3);
echo" $rss[MoneyS_M]";
?>
</font></span></td>
<td align="right" class="PADDING-RIGHT-5 BORDER-TOP"><span class="PADDING-LEFT-5">
<?=$row["Budget_use"]?>
</span></td>
</tr>
<?php
$no++;
} # while
?>
</table>
<?php } #if ?>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><?php if( $numrows > 0 ) { ?>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10"></td>
</tr>
<tr>
<td align="left"><span style="font-size:12px">หน้า:
<?php
/** ตรวจสอบการ Order By ของ Query */
if( $ASCDESC=="ASC") { $ASCDESC = "DESC"; } else { $ASCDESC="ASC"; }
$paging = ceil($numrows/$limit);
//=== Display the navigation
if ($display > 1) {
$previous = $display - 1;
?>
<a href="<?=$PHP_SELF;?>?page=1&perpage=<?=$perpage;?>&OrderBy=<?=$OrderBy;?>&ASCDESC=<?=$ASCDESC;?>&Budget_Year=<?=$Budget_Year;?>&Flag1=<?=$Flag1;?>"><font color="#FE830B">|« หน้าแรก</font></a> <a href="<?=$PHP_SELF;?>?page=<?=$previous;?>&perpage=<?=$perpage;?>&OrderBy=<?=$OrderBy;?>&ASCDESC=<?=$ASCDESC;?>&Budget_Year=<?=$Budget_Year;?>&Flag1=<?=$Flag1;?>"><font color="#FE830B">« ก่อนหน้า</font></a>
<?php
} // end..if
if($numrows != $limit) {
if($paging > $scroll) {
$first = $_GET['page'];
$last = ($scroll - 1) + $_GET['page'];
} else {
$first = 1;
$last = $paging;
}
if($last > $paging ) {
$first = $paging - ($scroll - 1);
$last = $paging;
}
for($i=$first; $i<=$last; $i++) {
if($display == $i) {
echo "<font color=red size=2> [<strong>$i</strong>] </font>";
}
else {
printf(" <a href=\"%s?page=%s&perpage=%s&OrderBy=%s&ASCDESC=%s&Budget_Year=%s&Flag1=%s\">%s</a> ", $_SERVER['PHP_SELF'], $i, $perpage, $OrderBy, $ASCDESC,Budget_Year,Flag1, $i );
}
} // end..for
} // end..if
if($display < $paging) {
$next = $display + 1;
?>
<a href="<?=$PHP_SELF;?>?page=<?=$next;?>&perpage=<?=$perpage;?>&OrderBy=<?=$OrderBy;?>&ASCDESC=<?=$ASCDESC;?>&Budget_Year=<?=$Budget_Year;?>&Flag1=<?=$Flag1;?>"><font color="#FE830B">ถัดไป »</font></a> <a href="<?=$PHP_SELF;?>?page=<?=$paging;?>&perpage=<?=$perpage;?>&OrderBy=<?=$OrderBy;?>&ASCDESC=<?=$ASCDESC;?>&Budget_Year=<?=$Budget_Year;?>&Flag1=<?=$Flag1;?>"><font color="#FE830B">หน้าสุดท้าย »|</font></a>
<?php
} // end..if
?>
</span></td>
</tr>
</table>
<?php } #if ?></td>
</tr>
</table></td>
</tr>
<tr>
</tr>
</table>
</fieldset>
<div align="center"><br>
<input type="button" name="Submit2" value=" ปิดหน้าต่าง" onClick="javascript:parent.close();" onMouseOver="this.style.cursor='hand'" />
</form></th>
</tr>
</table>
</body>
</html>
<?php
?>
|