Viewing file: StdSumreport.php (16.22 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
session_start();
if (session_is_registered("valid_user")&&session_is_registered("Priority")&&session_is_registered("password") )
{
include("../include/FunctionDB.php");
include("admin_menu.php");
ConnectDB();
$Username = $valid_user;
$sql = "SELECT * FROM user_tb WHERE Username='$Username'";
$result = mysql_query($sql) ;
$rs1 = mysql_fetch_array($result);
$row = mysql_num_rows($result);
$sql1 = "SELECT * FROM project_type_tb WHERE Budget_Year='$Budget_Year'";
$result1 = mysql_query($sql1) ;
$rs = mysql_fetch_array($result1);
$strSQL = "SELECT * FROM project_type_tb WHERE Budget_Year='$Budget_Year' Order By Faculty_code ";
if (! $Page)
$Page = 1;
$Pre_Page = $Page - 1;
$Next_Page = $Page +1;
$Per_Page = 30;
$result = mysql_query($strSQL);
$Page_start = ($Per_Page*$Page) - $Per_Page;
$Num_Rows = mysql_num_rows($result);
if( $Num_Rows <= $Per_Page)
$Num_Pages = 1;
else if (($Num_Rows % $Per_Page) == 0)
$Num_Pages = ($Num_Rows / $Per_Page);
else
$Num_Pages = ($Num_Rows / $Per_Page) + 1;
$Num_Pages = (int)$Num_Pages;
if (( $Page > $Num_Pages) || ($Page < 0))
echo"Page $Page More than $Num_Pages";
$strSQL .=" LIMIT $Page_start,$Per_Page" ;
$result = mysql_query($strSQL);
$num = mysql_num_rows( $result );
//$count = 0;
?>
<meta http-equiv="Content-Type" content="text/html; charset=TIS-620">
<link href="../source/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style17 {font-size: 14px}
.style18 {color: #003399; font-size: 14px; }
.style21 {
font-family: Tahoma;
font-size: 14px;
color: #0000FF;
}
.style22 {
font-family: Tahoma;
font-size: 14px;
}
.style15 {color: #FF0000}
.style42 {color: #000000; font-family: Tahoma; font-size: 14px;}
-->
</style>
<table width="852" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="852"><br>
<fieldset>
<legend><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>"><a href="PlaningByYear.php" >หน้าหลัก</a></font><font><span class="style17"><a href="EditPlaningList.php?Budget_Year=<? echo $rs[Budget_Year] ?>&Faculty_code=<? echo $rs[Faculty_code] ?>&Project_code=<? echo $rs[Project_code]?>"></a></span></font><font color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>"><span class="style17"><img src="../picture/ico3.gif" width="10" height="10" border="0" align="absmiddle" /><a href="RepPlanSum.php?Budget_Year=<? echo $rs[Budget_Year] ?>">รายงานการใช้เงินตามแผนดำเนินการ</a></span></font></legend>
<label><div align="center">
<form id="form1" name="form1" method="post" action="">
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" style="background-color:#eeeeee; border:0px solid gray"size="12">
<tr>
<td bgcolor="#FFFFFF"><font size="2" face="Tahoma"><img src="../picture/previous.gif" onclick="window.history.back()" width="85" height="22" border="0" /></font></td>
</tr>
<tr>
<td height="43" ><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr>
<td height="42" colspan="8" bgcolor="#FFFFFF"><div align="center"><span class="style22">ตารางสรุปจำนวนเงินตามแผนงาน ปีงบประมาณ</span>
<?=$rs["Budget_Year"]?>
</div></td>
</tr>
<tr>
<td height="24" colspan="8" bgcolor="#FFFFFF"> </td>
</tr>
<tr bordercolor="#003366">
<td width="127" align="center" bgcolor="#E0EDE6"><span class="style21">ภาค/ฝ่าย</span></td>
<td width="94" align="center" bgcolor="#E0EDE6"><font color="#0033CC" size="2" face="Tahoma">
<?php
$MoneyId = $rs["MoneyId"];
$sql = "Select * From money_source_tb Where MoneyS_C='1' ";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rss = mysql_fetch_array($result1);
echo "$rss[MoneyS_M]";
?>
</font></td>
<td width="94" align="center" bgcolor="#E0EDE6"><font color="#0033CC" size="2" face="Tahoma">
<?php
$MoneyId = $rs["MoneyId"];
$sql = "Select * From money_source_tb Where MoneyS_C='2' ";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rss = mysql_fetch_array($result1);
echo "$rss[MoneyS_M]";
?>
</font></td>
<td width="124" align="center" bgcolor="#E0EDE6"><font color="#0033CC" size="2" face="Tahoma">
<?php
$MoneyId = $rs["MoneyId"];
$sql = "Select * From money_source_tb Where MoneyS_C='3' ";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rss = mysql_fetch_array($result1);
echo "$rss[MoneyS_M]";
?>
</font></td>
<td width="90" align="center" bgcolor="#E0EDE6"><font color="#0033CC" size="2" face="Tahoma">
<?php
$MoneyId = $rs["MoneyId"];
$sql = "Select * From money_source_tb Where MoneyS_C='4' ";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rss = mysql_fetch_array($result1);
echo "$rss[MoneyS_M]";
?>
</font></td>
<td width="109" align="center" bgcolor="#E0EDE6"><font color="#0033CC" size="2" face="Tahoma">
<?php
$MoneyId = $rs["MoneyId"];
$sql = "Select * From money_source_tb Where MoneyS_C='5' ";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rss = mysql_fetch_array($result1);
echo "$rss[MoneyS_M]";
?>
</font></td>
<td width="126" align="center" bgcolor="#E0EDE6"><font color="#0033CC" size="2" face="Tahoma">
<?php
$MoneyId = $rs["MoneyId"];
$sql = "Select * From money_source_tb Where MoneyS_C='6' ";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rss = mysql_fetch_array($result1);
echo "$rss[MoneyS_M]";
?>
</font></td>
<td width="78" align="center" bgcolor="#E0EDE6"><span class="style22"><font color="#FF0000">รวม</font></span></td>
</tr>
<?php
$i = 1;
while($row = mysql_fetch_array($result))
{
if($count==0)
{
?>
<tr bordercolor="#FFCC99" bgcolor="#FFCCCC" >
<td align="center" bgcolor="#FFFFFF" ><?php
$Faculty_code = $row["Faculty_code"];
$sql = "Select * From faculty_tb Where Faculty_code='$Faculty_code' ";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rss = mysql_fetch_array($result1);
echo "$rss[Faculty_code] $rss[Faculty_name]";
?></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right"><strong><font color="#993333" size="2" face="Tahoma">
<?php
// $Faculty_code = $rs["Faculty_code"];
$sql1 = "Select Sum(Budget_use) as SumB1 From project_tb Where MoneyId='1' and Faculty_code='01' and Budget_Year='$Budget_Year' ";
$result1 = mysql_query($sql1) or die("Erro".mysql_error());
$rss1 = mysql_fetch_array($result1);
echo number_format($rss1[SumB1],2,'.',',');
//echo"$rss1[SumC1]";
?>
</font></strong></div></td>
<td bgcolor="#FFFFFF"><div align="right"><strong><font color="#993333" size="2" face="Tahoma">
<?php
// $Faculty_code = $rs["Faculty_code"];
$sql1 = "Select Sum(Budget_use) as SumB1 From project_type_tb Where MoneyS_C ='2' and Faculty_code='01' and Budget_Year='$Budget_Year' ";
$result1 = mysql_query($sql1) or die("Erro".mysql_error());
$rss1 = mysql_fetch_array($result1);
echo number_format($rss1[SumB1],2,'.',',');
//echo"$rss1[SumC1]";
?>
</font></strong></div></td>
<td bgcolor="#FFFFFF" ><div align="right"><font color="#0033CC" size="2" face="Tahoma"> <? echo number_format($row['Cost3'],2,'.',',');?></font></div></td>
<td bgcolor="#FFFFFF" ><div align="right"><font color="#0033CC" size="2" face="Tahoma"> <? echo number_format($row['Cost4'],2,'.',',');?></font></div></td>
<td bgcolor="#FFFFFF" ><div align="right"><font color="#0033CC" size="2" face="Tahoma"> <? echo number_format($row['Cost5'],2,'.',',');?></font></div></td>
<td bgcolor="#FFFFFF" ><div align="right"><font color="#0033CC" size="2" face="Tahoma"> <? echo number_format($row['Cost6'],2,'.',',');?></font></div></td>
<td bgcolor="#FFFFFF" ><div align="right"><font color="#FF0000" size="2" face="Tahoma">
<?php
$Sum4 = $row[Cost1] + $row[Cost2] + $row[Cost3] + $row[Cost4] + $row[Cost5] + $row[Cost6];
echo number_format($Sum4,2,'.',',');
// echo"$Sum4";
?>
</font></div></td>
</tr>
<?
$count=1;
}
else
{
?>
<tr bordercolor="#FFCC99" bgcolor="#FFCCCC">
<td align="center" bgcolor="#FFFFFF" ><?php
$Faculty_code = $row["Faculty_code"];
$sql = "Select * From faculty_tb Where Faculty_code='$Faculty_code' ";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rss = mysql_fetch_array($result1);
echo "$rss[Faculty_code] $rss[Faculty_name]";
?></td>
<td height="18" align="center" bgcolor="#FFFFFF" ><div align="right"><strong><font color="#993333" size="2" face="Tahoma">
<?php
// $Faculty_code = $rs["Faculty_code"];
$sql1 = "Select Sum(Budget_use) as SumB1 From project_tb Where MoneyId='1' and Faculty_code='01' and Budget_Year='$Budget_Year' ";
$result1 = mysql_query($sql1) or die("Erro".mysql_error());
$rss1 = mysql_fetch_array($result1);
echo number_format($rss1[SumB1],2,'.',',');
//echo"$rss1[SumC1]";
?>
</font></strong></div></td>
<td bgcolor="#FFFFFF"><div align="right"><strong><font color="#993333" size="2" face="Tahoma">
<?php
// $Faculty_code = $rs["Faculty_code"];
$sql1 = "Select Sum(Budget_use) as SumB1 From project_type_tb Where MoneyS_C ='2' and Faculty_code='01' and Budget_Year='$Budget_Year' ";
$result1 = mysql_query($sql1) or die("Erro".mysql_error());
$rss1 = mysql_fetch_array($result1);
echo number_format($rss1[SumB1],2,'.',',');
//echo"$rss1[SumC1]";
?>
</font></strong></div></td>
<td bgcolor="#FFFFFF" ><div align="right"><font color="#0033CC" size="2" face="Tahoma"> <? echo number_format($row['Cost3'],2,'.',',');?></font></div></td>
<td bgcolor="#FFFFFF" ><div align="right"><font color="#0033CC" size="2" face="Tahoma"> <? echo number_format($row['Cost4'],2,'.',',');?></font></div></td>
<td bgcolor="#FFFFFF" ><div align="right"><font color="#0033CC" size="2" face="Tahoma"> <? echo number_format($row['Cost5'],2,'.',',');?></font></div></td>
<td bgcolor="#FFFFFF" ><div align="right"><font color="#0033CC" size="2" face="Tahoma"><? echo number_format($row['Cost6'],2,'.',',');?></font></div></td>
<td bgcolor="#FFFFFF" ><div align="right"><font color="#FF0000" size="2" face="Tahoma">
<?php
$Sum4 = $row[Cost1] + $row[Cost2] + $row[Cost3] + $row[Cost4] + $row[Cost5] + $row[Cost6];
echo number_format($Sum4,2,'.',',');
// echo"$Sum4";
?>
</font></div></td>
</tr>
<?
$count=0;
}
$i++;
}
?>
<tr bgcolor="#E0EDE6" >
<td align="center" bordercolor="#DFDFDF" bgcolor="#FFFFFF" ><font color="#FF0000" size="2" face="Tahoma"><strong>รวม</strong></font></td>
<td align="center" bordercolor="#DFDFDF" bgcolor="#FFFFFF" ><div align="right"><font color="#993333" size="2" face="Tahoma">
<?php
$sql1 = "Select Sum(Cost1) as SumC1 From finance4_tb ";
$result1 = mysql_query($sql1) or die("Erro".mysql_error());
$rss1 = mysql_fetch_array($result1);
echo number_format($rss1[SumC1],2,'.',',');
//echo"$rss1[SumC1]";
?>
</font></div></td>
<td bordercolor="#DFDFDF" bgcolor="#FFFFFF"><div align="right"><font color="#993333" size="2" face="Tahoma">
<?php
$sql1 = "Select Sum(Cost2) as SumC2 From finance4_tb ";
$result1 = mysql_query($sql1) or die("Erro".mysql_error());
$rss2 = mysql_fetch_array($result1);
echo number_format($rss2[SumC2],2,'.',',');
// echo"$rss2[SumC2]";
?>
</font></div></td>
<td bordercolor="#DFDFDF" bgcolor="#FFFFFF" ><div align="right"><font color="#993333" size="2" face="Tahoma">
<?php
$sql3 = "Select Sum(Cost3) as SumC3 From finance4_tb ";
$result3 = mysql_query($sql3) or die("Erro".mysql_error());
$rss3 = mysql_fetch_array($result3);
echo number_format($rss3[SumC3],2,'.',',');
//echo"$rss3[SumC3]";
?>
</font></div></td>
<td bordercolor="#DFDFDF" bgcolor="#FFFFFF" ><div align="right"><font color="#993333" size="2" face="Tahoma">
<?php
$sql4 = "Select Sum(Cost4) as SumC4 From finance4_tb ";
$result4 = mysql_query($sql4) or die("Erro".mysql_error());
$rss4 = mysql_fetch_array($result4);
echo number_format($rss4[SumC4],2,'.',',');
// echo"$rss4[SumC4]";
?>
</font></div></td>
<td bordercolor="#DFDFDF" bgcolor="#FFFFFF" ><div align="right"><font color="#993333" size="2" face="Tahoma">
<?php
$sql5 = "Select Sum(Cost5) as SumC5 From finance4_tb ";
$result5 = mysql_query($sql5) or die("Erro".mysql_error());
$rss5 = mysql_fetch_array($result5);
echo number_format($rss5[SumC5],2,'.',',');
//echo"$rss5[SumC5]";
?>
</font></div></td>
<td bordercolor="#DFDFDF" bgcolor="#FFFFFF" ><div align="right"><font color="#993333" size="2" face="Tahoma">
<?php
$sql6 = "Select Sum(Cost6) as SumC6 From finance4_tb ";
$result6 = mysql_query($sql6) or die("Erro".mysql_error());
$rss6 = mysql_fetch_array($result6);
echo number_format($rss6[SumC6],2,'.',',');
//echo"$rss6[SumC6]";
?>
</font></div></td>
<td bordercolor="#DFDFDF" bgcolor="#FFFFFF" ><div align="right"><font color="#FF0000" size="2" face="Tahoma"><strong>
<?php
$SumAll = $rss1[SumC1] + $rss2[SumC2] + $rss3[SumC3] + $rss4[SumC4] + $rss5[SumC] + $rss6[SumC6];
echo number_format($SumAll,2,'.',',');
// echo"$SumAll";
?>
</strong></font></div></td>
</tr>
<tr>
<td colspan="8" align="center" bgcolor="#FFFFFF"><div align="center"><font color="#000000" size="2" face="Tahoma">ทั้งหมด <? echo $num ?> รายการ</font></div></td>
</tr>
</table> </td>
</tr>
</table>
<br>
</form>
</div>
</label>
</fieldset><br>
<font color="<?php echo $GLOBALS["COLOR_FONT_3"];?>" size="2"><b>หมายเหตุ :</b> ใช้เมาส์คลิกที่ชื่อ<br>
</font></td>
</tr>
</table>
<?php
}
else
{
echo"<meta http-equiv=\"refresh\" content=\"3;URL=../login.php\">\n";
echo"Please Login ";
}
?>
|