Viewing file: ExcelStdSum.php (7.87 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
header('Content-type: application/xls');
header('Content-Disposition: attachment; filename="project_plan.xls"');
include("../include/FunctionDB.php");
ConnectDB();
$sql = " SELECT * FROM projectStdPlan_tb WHERE Budget_Year='$Budget_Year' AND Faculty_code='$Faculty_code' ";
$result = mysql_query($sql) or die(" Error").mysql_error();
$rs = mysql_fetch_array($result);
$row = mysql_num_rows($result);
$strSQL = " SELECT * FROM projectStdPlan_tb WHERE Budget_Year='$Budget_Year' AND Faculty_code='$Faculty_code' ORDER BY Orderlist ASC ";
$result = mysql_query($strSQL);
$num = mysql_num_rows($result );
?>
<meta http-equiv="Content-Type" content="text/html; charset=TIS-620" />
<style type="text/css">
<!--
.style1 {
font-size: 14px;
font-weight: bold;
}
.style2 {font-size: 14px}
.style3 {
font-family: Tahoma;
font-size: 14px;
}
.style23 {font-size: 14}
-->
</style>
<table width="1020" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="1020"><br />
<fieldset>
<legend><span class="style3"><a href="PlaningByYear.php" class="style2"></a></span></legend>
<form id="form" name="form" method="get" action="SearchRepPlaning.php">
<table width="100%" cellpadding="0" cellspacing="0" style="background-color:#eeeeee; border:0px solid gray">
<tr bgcolor="#CCCCFF">
<td height="24" colspan="8" bgcolor="#eeeeee" ><input name="Project_code" type="hidden" id="Project_code" value="<?=$Project_code ?>" />
<input name="Faculty_code" type="hidden" id="Faculty_code" value="<?=$Faculty_code; ?>" />
<input name="Budget_Year" type="hidden" id="Budget_Year" value="<?=$Budget_Year; ?>" />
รายละเอียดแผนดำเนินการประจำปีงบประมาณ <? echo $Budget_Year; ?> หน่วยงาน <?php
//$Faculty_code = $row[Faculty_code];
$sql3 = " SELECT * FROM faculty_tb WHERE Faculty_code='$Faculty_code' ";
$result3 = mysql_query($sql3) or die("Error".mysql_error());
$rss = mysql_fetch_array($result3);
echo "$rss[Faculty_name]";
?></td>
</tr>
<tr bgcolor="#E6E6E6">
<td align="center" bgcolor="#FFFFFF"><span class="style3">ข้อ</span></td>
<td align="center" bgcolor="#FFFFFF"> </td>
<td align="center" bgcolor="#FFFFFF"><font color="#003366" face="Tahoma"><span class="style2">วัตถุประสงค์</span></font></td>
<td align="center" bgcolor="#FFFFFF"><span class="style2"><font color="#000066" face="Tahoma">ตัวชี้วัดความสำเร็จ</font></span></td>
<td align="center" bgcolor="#FFFFFF"><span class="style2"><font color="#000066" face="Tahoma">วิธีการดำเนินงาน</font></span></td>
<td align="center" bgcolor="#FFFFFF"><span class="style2"><font color="#003366" face="Tahoma">กลุ่มเป้าหมาย</font></span></td>
<td align="center" bgcolor="#FFFFFF"><span class="style23"><span class="style2"><font color="#003366" face="Tahoma">ผลที่คาดว่าจะได้รับ</font></span></span></td>
<td align="center" bgcolor="#FFFFFF">จำนวนเงิน</td>
</tr>
<?php
$i = 1;
while($row = mysql_fetch_array($result))
{
if($count==0)
{
?>
<tr bgcolor="#F7F7F7" >
<td width="20" align="center" bgcolor="#FFFFFF"><font color="#0033CC" size="2" face="Tahoma"><?=$row["Orderlist"]?></font></td>
<td width="245" align="left" bgcolor="#FFFFFF"><font color="#0033CC" size="2" face="Tahoma"><? echo $row['Project_plan'];?></font></td>
<td width="159" bordercolor="#EEEEEE" bgcolor="#FFFFFF"><font color="#0033CC" size="2" face="Tahoma"><? echo $row['Orderlist_2'];?></font></td>
<td width="124" bordercolor="#EEEEEE" bgcolor="#FFFFFF"><font color="#0033CC" size="2" face="Tahoma"><? echo $row['Project_name'];?></font></td>
<td width="152" bordercolor="#EEEEEE" bgcolor="#FFFFFF"><font color="#0033CC" size="2" face="Tahoma"><? echo $row['Project_rep'];?></font></td>
<td width="78" bordercolor="#EEEEEE" bgcolor="#FFFFFF"><font color="#0033CC" size="2" face="Tahoma"><? echo $row["Period"];?></font></td>
<td width="185" bordercolor="#EEEEEE" bgcolor="#FFFFFF"><font color="#0033CC" size="2" face="Tahoma"><? echo $row["Period_1"];?></font></td>
<td width="53" bordercolor="#EEEEEE" bgcolor="#FFFFFF"><font color="#993333" size="2" face="Tahoma">
<?php
$Project_code = $row["Project_code"];
$sql1 = " SELECT SUM(Budget_use) AS SumB1 FROM project_type_tb WHERE Project_code='$Project_code' AND Budget_Year='$Budget_Year' AND Faculty_code='$Faculty_code' ";
$result1 = mysql_query($sql1) or die("Error".mysql_error());
$rss1 = mysql_fetch_array($result1);
echo number_format($rss1[SumB1],2,'.',',');
?></font></td>
</tr>
<?
$count=1;
}
else
{
?>
<tr bgcolor="#FFFFFF">
<td align="center" bordercolor="#FFFFFF" ><font color="#0033CC" size="2" face="Tahoma"><? echo $row["Orderlist"]?></font></td>
<td align="left" ><font color="#0033CC" size="2" face="Tahoma"><? echo $row['Project_plan'];?></font></td>
<td bordercolor="#EEEEEE" ><font color="#0033CC" size="2" face="Tahoma"><? echo $row['Orderlist_2'];?></font></td>
<td bordercolor="#EEEEEE" ><font color="#0033CC" size="2" face="Tahoma"><? echo $row['Project_name'];?></font></td>
<td bordercolor="#EEEEEE" ><font color="#0033CC" size="2" face="Tahoma"><? echo $row['Project_rep'];?></font></td>
<td bordercolor="#EEEEEE" ><font color="#0033CC" size="2" face="Tahoma"><? echo $row["Period"];?></font></td>
<td bordercolor="#EEEEEE" ><font color="#0033CC" size="2" face="Tahoma"><? echo $row["Period_1"];?></font></td>
<td bordercolor="#EEEEEE" ><font color="#993333" size="2" face="Tahoma">
<?php
$Project_code = $row["Project_code"];
$sql1 = " SELECT SUM(Budget_use) AS SumB1 FROM project_type_tb WHERE Project_code='$Project_code' AND Budget_Year='$Budget_Year' AND Faculty_code='$Faculty_code' ";
$result1 = mysql_query($sql1) or die("Error".mysql_error());
$rss1 = mysql_fetch_array($result1);
echo number_format($rss1['SumB1'],2,'.',',');
?></font></td>
</tr>
<?
$count=0;
}
$i++;
}
?>
<tr bgcolor="#FFFFFF">
<td align="center"> </td>
<td align="center"bgcolor="#FFFFFF" > </td>
<td align="center"> </td>
<td align="center"> </td>
<td align="center"> </td>
<td align="center"> </td>
<td align="center">รวมจำนวนเงินตามฝ่าย</td>
<td align="center"><?php
$sql1 = " SELECT SUM(Budget_use) AS SumB1 FROM project_type_tb WHERE Budget_Year='$Budget_Year' AND Faculty_code='$Faculty_code' ";
$result1 = mysql_query($sql1) or die("Error".mysql_error());
$rss1 = mysql_fetch_array($result1);
echo number_format($rss1['SumB1'],2,'.',',');
?></td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="8" align="center" bgcolor="#FFFFFF" >ทั้งหมด <? echo $num; ?> รายการ</td>
</tr>
</table>
</form>
</fieldset>
</td>
</tr>
</table>
|