Viewing file: ExcelPlaningList.php (17.93 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
header('Content-type: application/xls');
header('Content-Disposition: attachment; filename="testing.xls"');
include("../include/FunctionDB.php");
ConnectDB();
$sql = "SELECT * FROM projectStdPlan_tb Where Faculty_code='$Faculty_code' and Budget_Year='$Budget_Year' and Project_code='$Project_code' ORDER BY Faculty_code,Orderlist ASC ";
$res = mysql_query($sql);
$rs = mysql_fetch_array($res);
//$Teacher_code = $rs[Teacher_code];
$strSQL = "SELECT * FROM project_type_tb Where Budget_Year='$Budget_Year' and Faculty_code='$Faculty_code' and Project_code='$Project_code' ORDER BY Orderlist ASC ";
if (! $Page)
$Page = 1;
$Pre_Page = $Page - 1;
$Next_Page = $Page +1;
$Per_Page = 50;
$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 );
?>
<meta http-equiv="Content-Type" content="text/html; charset=TIS-620">
<style type="text/css">
<!--
.style12 {font-size: 14px}
.style14 {font-size: 14px; font-weight: bold; }
.style23 {font-size: 14}
.style25 {
font-family: Tahoma;
font-size: 14px;
}
-->
</style>
<table width="1042" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="1042"><br>
<fieldset>
<legend></legend>
<label><div align="center">
<form id="form1" name="form1" method="get" action=" ">
<table width="99%" cellpadding="0" cellspacing="0" style="background-color:#eeeeee; border:0px solid gray">
<tr bgcolor="#CCCCFF">
<td height="24" colspan="17" bgcolor="#eeeeee" ><div align="center"><span class="style12"><font color="#000000" face="Tahoma"><font face="Tahoma"><font color="#000000" face="Tahoma"><span class="style14"><font color="#000000" face="Tahoma"><font face="Tahoma"><strong>
<font color="#000000" face="Tahoma"><font face="Tahoma"><strong><font color="#000000" face="Tahoma"><strong>
</strong><font face="Tahoma"><font color="#000000" face="Tahoma"><font color="#000000" face="Tahoma"><font face="Tahoma"><strong><font color="#000000" face="Tahoma"><font face="Tahoma"><strong><font color="#000000" face="Tahoma"><strong>
<input name="Project_code" type="hidden" id="Project_code" value="<?=$Project_code ?>" />
</strong></font></strong></font></font></strong></font></font></font></font><strong>
<input name="Faculty_code" type="hidden" id="Faculty_code" value="<?=$Faculty_code ?>" />
</strong></font></strong></font></font>
<input name="Budget_Year" type="hidden" id="Budget_Year" value="<?=$Budget_Year?>" />
</strong></font></font></span>รายละเอียดแผนดำเนินการประจำปีงบประมาณ </font></font></font></span><span class="style14"><font color="#000000" face="Tahoma"><font face="Tahoma"><strong><font color="#000000" face="Tahoma"><strong><span class="style12"><font color="#000066" face="Tahoma"><font color="#000000" face="Tahoma"><font face="Tahoma"><strong><font size="2" face="Tahoma"><font color="#003399"><? echo $Budget_Year?></font> </font></strong></font></font></font></span></strong></font></strong></font></font></span><span class="style12"><font color="#000000" face="Tahoma"><font face="Tahoma"><font color="#000000" face="Tahoma"><span class="style12"><font color="#000066" face="Tahoma"><font color="#000000" face="Tahoma"><font face="Tahoma"><font face="Tahoma"><span class="style12"><font color="#000000" face="Tahoma"><font face="Tahoma"><font color="#000000" face="Tahoma">หน่วยงาน</font></font></font></span></font></font></font></font></span></font></font></font></span> <span class="style12"><font color="#000000" size="2" face="Tahoma">
<?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]";
?>
</font></span></div></td>
</tr>
<tr bgcolor="#E6E6E6">
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray">หมวดเงิน</td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray">จำนวนเงิน</td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><span class="style23">ตุลาคม</span></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><span class="style23">พฤศจิกายน</span></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><span class="style23">ธันวาคม</span></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><span class="style23">มกราคม</span></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><span class="style23">กุมภาพันธ์</span></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><span class="style23">มีนาคม</span></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><span class="style23">เมษายน</span></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><span class="style23">พฤษภาคม</span></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><span class="style23">มิถุนายน</span></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><span class="style23">กรกฏาคม</span></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><span class="style23">สิงหาคม</span></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><span class="style23">กันยายน</span></td>
</tr>
<tr bgcolor="#E6E6E6">
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><span class="style12"><font color="#000000" face="Tahoma">ข้อ</font></span></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><font color="#000000" size="2" face="Tahoma">
<?php
//$Faculty_code = $row[Faculty_code];
$sql3 = "Select * From projectstdplan_tb Where Project_code='$Project_code'";
$result3 = mysql_query($sql3) or die("Error".mysql_error());
$rss = mysql_fetch_array($result3);
echo"$rss[Orderlist]";
?>
</font></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><div align="left"><font color="#000000" size="2" face="Tahoma">
<?php
//$Faculty_code = $row[Faculty_code];
$sql3 = "Select * From projectstdplan_tb Where Project_code='$Project_code'";
$result3 = mysql_query($sql3) or die("Error".mysql_error());
$rss = mysql_fetch_array($result3);
echo" $rss[Project_plan]";
?>
</font></div></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
</tr>
<?php
$i = 1;
while($row = mysql_fetch_array($result))
{
if($count==0)
{
?>
<tr bgcolor="#F7F7F7" >
<td width="12" align="center" bgcolor="#FFFFFF" ><div align="left"></div></td>
<td width="20" align="center" bgcolor="#FFFFFF" ><div align="left">
<?=$row["Orderlist"]?>
</a></div></td>
<td width="254" align="left" bgcolor="#FFFFFF" ><div align="left"><?=$row["Project_plan"]?>
</a></div></td>
<td width="64" bordercolor="#EEEEEE" bgcolor="#FFFFFF" ><div align="right"><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></div></td>
<td width="63" bgcolor="#FFFFFF" ><div align="right"><font color="#993333" size="2" face="Tahoma"> <?echo number_format($row['Budget_use'],2,'.',','); ?> </font></div></td>
<td width="49" bordercolor="#EEEEEE" bgcolor="#FFFFFF" >
<?=$row["October"]?>
</a></td>
<td width="62" bordercolor="#EEEEEE" bgcolor="#FFFFFF">
<?=$row["November"]?>
</a></td>
<td width="50" bordercolor="#EEEEEE" bgcolor="#FFFFFF">
<?=$row["December"]?>
</a></td>
<td width="60" bordercolor="#EEEEEE" bgcolor="#FFFFFF">
<?=$row["January"]?>
</a></td>
<td width="51" bordercolor="#EEEEEE" bgcolor="#FFFFFF">
<?=$row["February"]?>
</a></td>
<td width="48" bordercolor="#EEEEEE" bgcolor="#FFFFFF">
<?=$row["March"]?>
</a></td>
<td width="48" bordercolor="#EEEEEE" bgcolor="#FFFFFF">
<?=$row["April"]?>
</a></td>
<td width="54" bordercolor="#EEEEEE" bgcolor="#FFFFFF">
<?=$row["May"]?>
</a></td>
<td width="46" bordercolor="#EEEEEE" bgcolor="#FFFFFF">
<?=$row["June"]?>
</a></td>
<td width="49" bordercolor="#EEEEEE" bgcolor="#FFFFFF">
<?=$row["July"]?>
</a></td>
<td width="43" bordercolor="#EEEEEE" bgcolor="#FFFFFF">
<?=$row["Augus"]?>
</a></td>
<td width="57" bordercolor="#EEEEEE" bgcolor="#FFFFFF">
<?=$row["September"]?>
</a></td>
</tr>
<?
$count=1;
}
else
{
?>
<tr bgcolor="#FFFFFF">
<td align="center" bordercolor="#FFFFFF" ><div align="left"></div></td>
<td align="center" bordercolor="#FFFFFF" ><div align="left">
<?=$row["Orderlist"]?>
</a></div></td>
<td align="left" ><div align="left">
<?=$row["Project_plan"]?>
</a></div></td>
<td bordercolor="#EEEEEE" ><div align="right"><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></div></td>
<td bordercolor="#FFFFFF" bgcolor="#FFFFFF" ><div align="right"><font color="#993333" size="2" face="Tahoma"> <?echo number_format($row['Budget_use'],2,'.',','); ?> </font></div></td>
<td bordercolor="#EEEEEE" ><?=$row["October"]?>
</a></td>
<td bordercolor="#EEEEEE" ><?=$row["November"]?>
</a></td>
<td bordercolor="#EEEEEE" ><?=$row["December"]?>
</a></td>
<td bordercolor="#EEEEEE" ><?=$row["January"]?>
</a></td>
<td bordercolor="#EEEEEE" ><?=$row["February"]?>
</a></td>
<td bordercolor="#EEEEEE" ><?=$row["March"]?>
</a></td>
<td bordercolor="#EEEEEE" ><?=$row["April"]?>
</a></td>
<td bordercolor="#EEEEEE" ><?=$row["May"]?>
</a></td>
<td bordercolor="#EEEEEE" ><?=$row["June"]?>
</a></td>
<td bordercolor="#EEEEEE" ><?=$row["July"]?>
</a></td>
<td bordercolor="#EEEEEE" ><?=$row["Augus"]?>
</a></td>
<td bordercolor="#EEEEEE" ><?=$row["September"]?>
</a></td>
</tr>
<?
$count=0;
}
$i++;
}
?>
<tr bgcolor="#FFFFFF">
<td align="center" > </td>
<td align="center" > </td>
<td align="center" bgcolor="#FFFFFF" ><span class="style25">รวมจำนวนเงินตามข้อหลัก</span></td>
<td align="center" > </td>
<td align="center" bgcolor="#FFFFFF" ><div align="right"><strong><font color="#993333" size="2" face="Tahoma">
<?php
$sql = "Select Sum(Budget_use) as Sum From project_type_tb Where Budget_Year='$Budget_Year' AND Faculty_code='$Faculty_code' and project_code='$Project_code' ";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rss1 = mysql_fetch_array($result1);
echo number_format($rss1['Sum'],2,'.',',');
CloseDB();
?>
</font></strong></div></td>
<td align="center" > </td>
<td align="center" > </td>
<td align="center" > </td>
<td align="center" > </td>
<td align="center" > </td>
<td align="center" > </td>
<td align="center" > </td>
<td align="center" > </td>
<td align="center" > </td>
<td align="center" > </td>
<td align="center" > </td>
<td align="center" > </td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="17" align="center" bgcolor="#FFFFFF" ><span class="style12"><font color="#000000" face="Tahoma">ทั้งหมด</font></span><strong><font color="#003399" size="2" face="Tahoma"> <? echo $num ?> </font></strong><font color="#FFFFFF" face="Tahoma"><span class="style12"><font color="#003366">รายการ</font></span></font><font color="#FFFFFF" size="2" face="Tahoma"><font color="#FFFFFF"> </font></font> </td>
</tr>
</table>
<div align="center">
<div align="center"><font color="#FFFFFF"> <font color="#FFFFFF" size="3" face="MS Sans Serif"><strong> <font color="#FFFFFF"><font color="#FFFFFF" size="3" face="MS Sans Serif"><strong><font color="#0033CC" size="2" face="Tahoma"><?php echo $Num_Pages;?></font></strong></font></font><font color="#0033CC" size="2" face="Tahoma"> </font></strong></font><font color="#000000" size="2" face="Tahoma"> หน้า</font></font> <font color="#FFFFFF"><font color="#0033CC" size="2" face="Tahoma"><strong>
<?php
if ($Pre_Page)
echo"<a href=\"$PHP_SELF?Page=$Pre_Page&&Budget_Year=$Budget_Year&&Faculty_code=$Faculty_code\" class=\"PageLink\"><font =\"Ms San serif\" size=\"2\"><b><< Previus</b> </font></a>";
for($i=1;$i<=$Num_Pages;$i++)
{
if($i != $Page)
echo" [<a href=\"$PHP_SELF?Page=$i&&Budget_Year=$Budget_Year&&Faculty_code=$Faculty_code\" class=\"PageLink\"><font =\"Ms San serif\" size=\"2\"><b>$i</b></font></a>] ";
else
echo"<b>$i</b>";
}
if($Page != $Num_Pages)
echo"<a href=\"$PHP_SELF?Page=$Next_Page&&Budget_Year=$Budget_Year&&Faculty_code=$Faculty_code\" class=\"PageLink\"><font =\"Ms San serif\" size=\"2\"><b> Next >></b> </font></a>";
?>
</strong></font></font></div>
</form>
</label>
</fieldset><br>
<font color="<?php echo $GLOBALS["COLOR_FONT_3"];?>" size="2"><br>
</font></td>
</tr>
</table>
|