Viewing file: sourcesYear.php (11.81 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 = "project_year";
$myTablePK = "Budget_Year";
$startDate1 = ($Budget_Year - 1)."-10-01";
$endDate1 = ($Budget_Year - 1)."-12-31";
$startDate2 = ($Budget_Year )."-01-01";
$endDate2 = ($Budget_Year )."-03-31";
$startDate3 = ($Budget_Year )."-04-01";
$endDate3 = ($Budget_Year )."-06-30";
$startDate4 = ($Budget_Year )."-07-01";
$endDate4 = ($Budget_Year )."-09-30";
/** Parameters */
$params = "Budget_Year=$Budget_Year";
} # 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>
<title>ข้อมูลแผนดำเนินงานและรายงาน : รายงานประเภทต่างๆ - สรุปยอดเงินที่ใช้จริงตามแผน</title>
<script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body topmargin="0" rightmargin="0" bottommargin="0" leftmargin="0">
<?php
include("../templates/incHeader.php");
?>
<table width="1003" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="203" align="left" valign="top" style="padding:10px 0px 0px 5px"><?php include("./_incMainMenu.php");?></td>
<td width="800" align="center" valign="top" style="padding:10px 0px 5px 10px">
<?php
/** Query เพื่อหา Numrows ก่อน */
$query = " SELECT * FROM $myTable Where Budget_Year ='$Budget_Year' ";
$result = $dbObj->execQuery($query);
$numrows = $dbObj->_numrows;
?>
<fieldset>
<table width="780" border="0" cellspacing="0" cellpadding="0">
<form id="myForm" name="myForm" method="post" action="<?=$PHP_SELF;?>?page=<?=$page;?>">
<tr>
<td height="5" colspan="2"></td>
</tr>
<tr>
<td width="570" height="30" background="../images/background/bg-head-topic.gif" class="PADDING-LEFT-10"><strong><a href="index.php">หน้าหลัก</a></strong> <strong>» <a href="Menu_Report.php?Budget_Year=<?=$Budget_Year ;?>">รายงานประเภทต่างๆ</a> » <span class="NOTE">ตารางสรุปการตามแหล่งเงิน</span></strong></td>
<td width="210" align="right" style="padding-right:10px"> </td>
</tr>
<tr>
<td colspan="2"><table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td 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></td>
</tr>
<tr>
<td height="33" align="right" class="PADDING-TOP-10 ">เลือกปีงบประมาณ
<select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)">
<option>
<?php
$strSQL = " SELECT * FROM project_year ORDER by Budget_Year asc ";
$result4 = mysql_query($strSQL);
while( $rs4 = mysql_fetch_array($result4) ) {
?>
</option>
<option value="sourcesYear.php?Budget_Year=<?=$rs4['Budget_Year'];?>" <?php if( $rs4['Budget_Year']==$Budget_Year ) echo 'selected'; ?>>
<?=$rs4['Budget_Year'];?>
</option>
<?php
} # while
?>
</select>
</td>
</tr>
</table></td>
</tr>
<tr>
<td height="196" colspan="2" align="center" valign="top"><table width="699" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="background-color:#eeeeee; border:0px solid gray">
<tr bgcolor="#F8F8F8">
<td height="22" colspan="6" align="left" bordercolor="#999966" class="PADDING-LEFT-10">ปีงบประมาณ
<?=$Budget_Year ;?>
</td>
</tr>
<?php
$no = 1+($display-1)*$limit;
while( $rs = $dbObj->fetchArray($result) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
?>
<tr bgcolor="<?=$bgColor;?>">
<td height="20" align="left"> </td>
<td align="center" class="PADDING-LEFT-3 BORDER-TOP BORDER-LEFT">รายการ</td>
<td align="center"class="PADDING-LEFT-3 BORDER-TOP BORDER-LEFT">จำนวนเงินที่ขอใช้</td>
<td align="center"class="PADDING-LEFT-3 BORDER-TOP BORDER-LEFT">จำนวนเงินที่ใช้จริง</td>
<td align="center"class="PADDING-LEFT-3 BORDER-TOP BORDER-LEFT-RIGHT">คงเหลือเงิน</td>
<td align="center"class="PADDING-LEFT-3 BORDER-TOP BORDER-RIGHT">ร้อยละ</td>
</tr>
<?php
$sql =" SELECT * FROM money_source_tb " ;
$result6 = $dbObj->execQuery($sql);
$no = 1+($display-1)*$limit;
while( $rss = $dbObj->fetchArray($result6) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
?>
<tr bgcolor="<?=$bgColor;?>">
<td width="2%" height="20" align="left"> </td>
<td width="34%" align="left" class="PADDING-LEFT-3 BORDER-TOP BORDER-LEFT"><img src="../images/icons/calendar-select-month.png" width="16" height="16" border="0" align="absmiddle" /> <a href="ProjectSources.php?Budget_Year=<?=$Budget_Year; ?>&MoneyS_C=<?=$rss['MoneyS_C'];?>"><?php
echo "$rss[MoneyS_M]"; ?></a></td>
<td width="19%" align="right"class="PADDING-RIGHT-5 BORDER-TOP BORDER-LEFT"><?php
$sql1 = " SELECT SUM(Budget_total) AS SumB1 FROM project_type_tb WHERE MoneyS_C='$rss[MoneyS_C]' AND Budget_Year='$Budget_Year' ";
$result1 = mysql_query($sql1);
$rss1 = mysql_fetch_array($result1);
echo number_format($rss1['SumB1'],2,'.',',');
?> </a>
</td>
<td width="19%" align="right" class="PADDING-RIGHT-5 BORDER-TOP BORDER-LEFT">
<?php
$sql3 = " SELECT SUM(Spending_use) AS SumB2 FROM project_tb pt, project_type_tb ptt WHERE pt.Budget_Year='$Budget_Year' and pt.MoneyS_C='$rss[MoneyS_C]' and pt.ProjectId=ptt.ProjectId ";
$result3 = $dbObj->execQuery($sql3);
$rss3 = $dbObj->fetchArray($result3);
echo number_format($rss3['SumB2'],2,'.',',');
?>
</td>
<td width="19%" align="right" class="PADDING-RIGHT-5 BORDER-TOP BORDER-LEFT-RIGHT">
<?php
$sql1 = " SELECT SUM(Budget_total) AS SumB1 FROM project_type_tb WHERE MoneyS_C='$rss[MoneyS_C]' AND Budget_Year='$Budget_Year' ";
$result1 = mysql_query($sql1);
$rss1 = mysql_fetch_array($result1);
$sql10 = " SELECT SUM(Spending_use) AS SumB2 FROM project_tb pt, project_type_tb ptt WHERE pt.MoneyS_C='$rss[MoneyS_C]' AND pt.Budget_Year='$Budget_Year' and pt.ProjectId=ptt.ProjectId ";
$result10 = mysql_query($sql10);
$rss10 = mysql_fetch_array($result10);
//echo number_format($rss10['SumB2'],2,'.',',');
$Sum4 = $rss1[SumB1] - $rss10[SumB2] ;
echo number_format($Sum4,2,'.',',');
?>
</td>
<td width="7%" align="center" class="PADDING-RIGHT-5 BORDER-TOP BORDER-RIGHT"><?php
$sql3 = " SELECT SUM(Budget_total) AS SumC1 FROM project_type_tb WHERE MoneyS_C='$rss[MoneyS_C]' AND Budget_Year='$Budget_Year' ";
$result3 = $dbObj->execQuery($sql3);
$rss3 = $dbObj->fetchArray($result3);
$sql10 = " SELECT SUM(Spending_use) AS SumB2 FROM project_tb pt, project_type_tb ptt WHERE pt.Budget_Year='$Budget_Year' and pt.MoneyS_C='$rss[MoneyS_C]' and pt.ProjectId=ptt.ProjectId ";
$result10 = $dbObj->execQuery($sql10);
$rss10 = $dbObj->fetchArray($result10);
$Sum4 = $rss3[SumC1] - $rss10[SumB2] ;
$per4 = ($rss10[SumB2] * 100 ) / $rss3[SumC1];
echo number_format($per4,2,'.','.');
?></td>
<?php
$no ++;
} # while
?>
</tr>
<tr bgcolor="<?=$bgColor;?>">
<td height="20" align="left"></td>
<td align="center" class="PADDING-LEFT-3 BORDER-TOP BORDER-LEFT">สรุปการใช้เงิน</td>
<td align="right" class="PADDING-RIGHT-5 BORDER-TOP BORDER-LEFT"><?php
$sql3 = " SELECT SUM(Budget_total) AS SumC5 FROM project_type_tb WHERE Budget_Year='$Budget_Year' ";
$result3 = $dbObj->execQuery($sql3);
$rss3 = $dbObj->fetchArray($result3);
echo number_format($rss3['SumC5'],2,'.',',');
?></td>
<td align="right" class="PADDING-RIGHT-5 BORDER-TOP BORDER-LEFT"><?php
$sql3 = " SELECT SUM(Spending_use) AS SumB2 FROM project_tb WHERE Budget_Year='$Budget_Year' ";
$result3 = $dbObj->execQuery($sql3);
$rss3 = $dbObj->fetchArray($result3);
echo number_format($rss3['SumB2'],2,'.',',');
?></td>
<td align="right" class="PADDING-RIGHT-5 BORDER-TOP BORDER-LEFT-RIGHT">
<?php
$sql3 = " SELECT SUM(Budget_total) AS SumC1 FROM project_type_tb WHERE Budget_Year='$Budget_Year' ";
$result3 = $dbObj->execQuery($sql3);
$rss3 = $dbObj->fetchArray($result3);
$sql10 = " SELECT SUM(Spending_use) AS SumB2 FROM project_tb WHERE Budget_Year='$Budget_Year' ";
$result10 = $dbObj->execQuery($sql10);
$rss10 = $dbObj->fetchArray($result10);
$Sum4 = $rss3[SumC1] - $rss10[SumB2] ;
echo number_format($Sum4,2,'.',',');
?>
</td>
<td align="center" class="PADDING-RIGHT-5 BORDER-TOP BORDER-RIGHT"><?php
$sql3 = " SELECT SUM(Budget_total) AS SumC1 FROM project_type_tb WHERE Budget_Year='$Budget_Year' ";
$result3 = $dbObj->execQuery($sql3);
$rss3 = $dbObj->fetchArray($result3);
$sql10 = " SELECT SUM(Spending_use) AS SumB2 FROM project_tb WHERE Budget_Year='$Budget_Year' ";
$result10 = $dbObj->execQuery($sql10);
$rss10 = $dbObj->fetchArray($result10);
$Sum4 = $rss3[SumC1] - $rss10[SumB2] ;
$per4 = ($rss10[SumB2] * 100 ) / $rss3[SumC1];
echo number_format($per4,2,'.','.');
?></td>
</tr>
<?php
$no++;
} # while
?>
</table></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr></form></table>
</fieldset></td>
</tr>
</table>
<?php include("../templates/incFooter.php"); ?>
</body>
</html>
<?php
/** Free Resource */
$dbObj->freeresult($result);
/** Close the Database */
$dbObj->disconn();
/** Unset Class */
unset($dbObj);
?>
|