Viewing file: ExcelRepPlaning.php (21.28 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");
include("../include/Function.php");
include("../link/function.php");
ConnectDB();
$sql = "SELECT * FROM project_tb WHERE Orderlist='$Orderlist' and Project_code ='$Project_code' 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 project_tb WHERE ProjectId='$ProjectId' Order By Date 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">
<!--
.style2 {font-size: 14px}
.style1 { font-size: 14px;
font-weight: bold;
}
.style6 {font-size: 14px; color: #000000; }
.style8 {font-size: 14px; font-family: Tahoma; }
.style9 {color: #000000}
-->
</style>
<script type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="720">
<fieldset>
<legend></legend>
<form id="form1" name="form1" method="post" action="">
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" style="background-color:#eeeeee; border:0px solid gray">
<tr bgcolor="#CCCCFF">
<td height="24" colspan="8" bgcolor="#FFFFFF" > </td>
</tr>
<tr bgcolor="#CCCCFF">
<td height="24" colspan="8" bgcolor="#FFFFFF" ><div align="center" class="style1"><font color="#000000" face="Tahoma">บันทึกการใช้เงินตามแผน/โครงการ</font><font color="#990099" size="2" face="Tahoma"></a></font></div></td>
</tr>
<tr bgcolor="#E6E6E6">
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td colspan="2" rowspan="3" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><div align="right"><span class="style8"><font size="2" face="Tahoma">เลขที่</font></span></div></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><div align="left">................</div></td>
</tr>
<tr bgcolor="#E6E6E6">
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><div align="center"><font size="1" face="Tahoma">
<?php
$sday = $rs[Start_Date];
$yearthai = explode("-",$sday);
$day = intval($yearthai[2]);
$month = intval($yearthai[1]);
$year = intval($yearthai[0]);
//////////////////
// $yearthai = $day ;
$m = getThaiSubMonth($month);
//echo"$day"." "."$m"." "."$year";
echo abbreDate(date("d-m-Y"));
?>
</font></div></td>
</tr>
<tr bgcolor="#E6E6E6">
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
</tr>
<tr bgcolor="#E6E6E6">
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td colspan="6" align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><div align="left"><span class="style6"> <font face="Tahoma">หน่วยงาน</font> </span><font color="#000000" size="2" face="Tahoma">
<?php
//$Faculty_code = $rs["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]";
?>
</font></div></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
</tr>
<tr bgcolor="#E6E6E6">
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td colspan="6" align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
</tr>
<tr bgcolor="#E6E6E6">
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td colspan="6" align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><div align="left"><span class="style8">ตัวบงชี้ QA ข้อท</span>ี่ <font size="2" face="Tahoma">
<?=$rs["Ind"]?>
</font><font color="#000000" size="2" face="Tahoma">
<?php
//$Faculty_code = $row[Faculty_code];
$sql3 = "Select * From project_tb Where codeId='$codeId' " ;
$result3 = mysql_query($sql3) or die("Error".mysql_error());
$rss = mysql_fetch_array($result3);
echo" $rss[Ind]";
?>
</font></div></td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
</tr>
<tr bgcolor="#E6E6E6">
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td colspan="6" align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
</tr>
<tr bgcolor="#E6E6E6">
<td width="21" align="center" bgcolor="#FFFFFF" style="border:0px solid gray"> </td>
<td colspan="6" align="center" bgcolor="#FFFFFF" style="border:0px solid gray"><div align="left"><span class="style2"><font color="#000000" face="Tahoma">ข้อแผน</font><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]";
?>
<?php
//$Faculty_code = $row[Faculty_code];
$sql3 = "Select * From project_type_tb Where ProjectId='$ProjectId' " ;
$result3 = mysql_query($sql3) or die("Error".mysql_error());
$rss = mysql_fetch_array($result3);
echo" $rss[Project_plan]";
?>
</font></span></div></td>
<td width="108" 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 align="center" bgcolor="#FFFFFF" ></td>
<td width="43" align="center" bordercolor="#EEEEEE" bgcolor="#FFFFFF" ><div align="left"><font size="2" face="Tahoma">
<?=$row["Orderlist"]?>
</font>
</div>
</font></td>
<td colspan="3" align="center" bordercolor="#EEEEEE" bgcolor="#FFFFFF" ><div align="left"><span class="style9"><font size="2" face="Tahoma"><?=$row["Training_name"]?>
</font></span><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 colspan="2" bordercolor="#EEEEEE" bgcolor="#FFFFFF" ><div align="center"><font color="#003366" size="2" face="Tahoma"><font color="#003366" size="2" face="Tahoma">
<?=abbreDate3($row["Date"]);?>
</font></font></div></td>
<td bgcolor="#FFFFFF" ><div align="right"><font color="#000000" size="2" face="Tahoma"> <?echo number_format($row['Budget_use'],2,'.',','); ?> </font></div></td>
</tr>
<?
$count=1;
}
else
{
?>
<tr bgcolor="#FFFFFF">
<td align="center" bordercolor="#FFFFFF" > </td>
<td align="center" bordercolor="#EEEEEE" bgcolor="#FFFFFF" ><div align="right"></font>
<div align="left"><font size="2" face="Tahoma">
<?=$row["Orderlist"]?>
</font> </div>
</a></td>
<td colspan="3" align="center" bordercolor="#EEEEEE" ><div align="left"><font size="2" face="Tahoma"><span class="style9"><?=$row["Training_name"]?>
</span></font> <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 colspan="2" bordercolor="#EEEEEE" ><div align="center"><font color="#003366" size="2" face="Tahoma"><font color="#003366" size="2" face="Tahoma">
<?=abbreDate3($row["Date"]);?>
</font></font></div></td>
<td bordercolor="#FFFFFF" bgcolor="#FFFFFF" ><div align="right"><font color="#000000" size="2" face="Tahoma"> <?echo number_format($row['Budget_use'],2,'.',','); ?> </font></div></td>
</tr>
<?
$count=0;
}
$i++;
}
?>
<tr bgcolor="#FFFFFF">
<td align="center" > </td>
<td align="center" > </td>
<td width="109" align="center" > </td>
<td width="88" align="center" > </td>
<td align="center" > </td>
<td colspan="2" align="center" ><div align="right"><font face="Tahoma"><strong><span class="style6"> </span></strong><span class="style6"> จำนวนเงินที่ใช้</span></font></div></td>
<td align="center" ><div align="right"><strong><font color="#000000" size="2" face="Tahoma">
<?php
$sql1 = "Select Sum(Budget_use) as SumB1 From project_tb Where ProjectId='$ProjectId' " ;
$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>
</tr>
<tr bgcolor="#FFFFFF">
<td align="center" > </td>
<td align="center" > </td>
<td align="center" > </td>
<td align="center" > </td>
<td align="center" > </td>
<td colspan="2" align="center" ><div align="right"><font face="Tahoma"><span class="style6"> วงเงินที่ตั้งไว้ตามแผน</span></font></div></td>
<td align="center" ><div align="right"><strong><font color="#000000" size="2" face="Tahoma">
<?php
// $Orderlist_2 = $rss["Orderlist_2"];
$sql2 = "Select * From project_type_tb Where ProjectId='$ProjectId' " ;
$result2 = mysql_query($sql2) or die("Erro".mysql_error());
$rss2 = mysql_fetch_array($result2);
echo number_format($rss2[Budget_use],2,'.',',');
// echo"$rss2[Budget_use]";
?>
</font></strong></div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="center" > </td>
<td align="center" > </td>
<td align="center" > </td>
<td align="center" > </td>
<td align="center" > </td>
<td colspan="2" align="center" ><div align="right"><font face="Tahoma"><span class="style6"> คงเหลือเงินตามแผน</span></font></div></td>
<td align="center" ><div align="right"><font color="#000000" face="Tahoma"><strong>
<?php
$Delete3 = $rss2[Budget_use] - $rss1[SumB1] ;
echo number_format($Delete3,2,'.',',');
// echo"$Del4";
?>
</strong></font></div></td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="8" align="center" bgcolor="#FFFFFF" ><span class="style2"><font color="#000000" face="Tahoma">ทั้งหมด</font></span><font color="#003399" size="2" face="Tahoma"> <? echo $num ?></font> <span class="style2"><font color="#FFFFFF" face="Tahoma"><font color="#003366">รายการ</font><font color="#FFFFFF"> </font></font></span></td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="8" align="center" bgcolor="#FFFFFF" > </td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="8" align="center" bgcolor="#FFFFFF" > </td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="8" align="center" bgcolor="#FFFFFF" > </td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="2" align="center" bgcolor="#FFFFFF" ><span class="style8">เรียน ผ.อ </span></td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" ><div align="right"><span class="style8">ตรวจสอบแล้ว</span></div></td>
<td align="center" bgcolor="#FFFFFF" > </td>
<td width="126" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" > </td>
</tr>
<tr bgcolor="#CCCCFF">
<td align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" ><input name="checkbox2" type="checkbox" class="style8" id="checkbox2" value="checkbox" /></td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > <div align="center">.................................</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="left" class="style8"></div></td>
<td width="20" align="center" bgcolor="#FFFFFF" ><span class="style2"><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></span>
<input name="checkbox" type="checkbox" class="style8" id="checkbox" value="checkbox" /></td><td colspan="2" align="center" bgcolor="#FFFFFF" ><div align="left">...............................
<label></label></td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" > </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" > </td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" ><div align="center"><span class="style8">หัวหน้าาค/ฝ่าย</span></div></td>
<td align="center" bgcolor="#FFFFFF" > </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" ><span class="style8">ฝ่ายบริหาร</span></td>
<td align="center" bgcolor="#FFFFFF" > </td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" > </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" > </td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<label></label>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><input name="checkbox3" type="checkbox" class="style8" id="checkbox3" value="checkbox" /></td>
<td align="center" bgcolor="#FFFFFF" ><div align="left" class="style8">
อนุมัติ
</div></td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" > </td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" ><div align="right" class="style8"></div></td>
<td colspan="3" align="center" bgcolor="#FFFFFF" ><div align="left"><span class="style8">หมายเหต</span>..................................</div></td>
<td align="center" bgcolor="#FFFFFF" > </td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" > </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" > </td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" >...................................</td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" > </td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" ><span class="style8">ผู้อำนวยการ</span></td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" > </td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" > </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" > </td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td width="196" align="center" bgcolor="#FFFFFF" > </td>
<td colspan="2" align="center" bgcolor="#FFFFFF" > </td>
<td align="center" bgcolor="#FFFFFF" > </td>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="8" align="center" bgcolor="#FFFFFF" ><div align="center">
<input name="button" type="button" id="button" onclick="window.print()" value="พิมพ์ใบขออนุมัติ" />
<input name="close" type="button" id="close" onclick="window.close()" value=" ปิดหน้าต่าง" />
</div></td>
</tr>
</table>
</form>
</fieldset>
</td>
</tr>
</table>
|