Viewing file: ExcelMonnyPersonList.php (21.63 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");
ConnectDB();
$Username = $valid_user;
$sql = "SELECT * FROM personal_tb WHERE Username='$Username'";
$res = mysql_query($sql);
$rs = mysql_fetch_array($res);
$sql1 = "SELECT * FROM salary_repot_tb WHERE Start_year='$Start_year' and Start_mont='$Start_mont' ";
$res1 = mysql_query($sql1);
$rs = mysql_fetch_array($res1);
$strSQL = "SELECT * FROM salary_repot_tb Where StatusId='1' and Start_year='$Start_year' and Start_mont='$Start_mont' and Person_type ='$Person_type' Order By Teacher_id ASC";
if (! $Page)
$Page = 1;
$Pre_Page = $Page - 1;
$Next_Page = $Page +1;
$Per_Page = 290;
$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">
<!--
.style1 {font-size: 14px}
.style2 {
font-family: Tahoma;
font-size: 12px;
}
.style4 {font-family: Tahoma; font-size: 14px; font-weight: bold; }
.style5 {font-family: Tahoma}
.style8 {font-size: 12px}
-->
</style>
<table width="1238" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="1238"><fieldset>
<label><div align="center">
<form id="form1" name="form1" method="post" action="">
<table width="99%" border="0" cellpadding="0" cellspacing="0" style="background-color:#eeeeee; border:0px solid gray">
<tr bgcolor="#CCCCFF">
<td height="24" colspan="23" bgcolor="#FFFFFF" ><div align="center"><span class="style1"><font color="#003366" face="Tahoma">รายงานเงินเดือน</font><font size="4" face="Tahoma"><font color="#003399">
<?php
$Ptype_code = $rs["Person_type"];
// $Person_type = $rs["Ptype_code"];
$sql = "Select * From person_type_tb Where Ptype_code='$Person_type'";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rss = mysql_fetch_array($result1);
echo "$rss[Ptype_name]";
?>
</font></font> </span><font size="4" face="Tahoma"><font color="#003399">
<?php
$monthCode = $rs["Start_mont"];
$sql = "Select * From month_tb Where monthCode='$monthCode'";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rss = mysql_fetch_array($result1);
echo "$rss[month]";
?>
<? echo $Start_year?></font></font></div></td>
</tr>
<tr bgcolor="#E6E6E6">
<td width="23" align="center" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2 style5 style8"><font color="#000000">No.</font></span></td>
<td width="36" align="center" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2 style5 style8">รหัส</span></td>
<td width="192" align="center" bgcolor="#FF9966" style="border:1px solid gray"> <span class="style2 style5 style8"><font color="#000000">ชื่อ</font></span></td>
<td width="63" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2 style5 style8">เงินเดือน</span></td>
<td width="43" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2 style5 style8">Dr-2</span></td>
<td width="43" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2 style5 style8">Dr-3</span></td>
<td width="43" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2 style5 style8">Dr-4</span></td>
<td width="43" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2 style5 style8">Dr-5</span></td>
<td width="43" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2 style5 style8">Dr-6</span></td>
<td width="43" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2 style5 style8">Dr-7</span></td>
<td width="43" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2 style5 style8">Dr-8</span></td>
<td width="64" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2 style5 style8">รวมรายรับ</span></td>
<td width="43" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2">Cr-1</span></td>
<td width="43" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2">Cr-2</span></td>
<td width="43" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2">Cr-3</span></td>
<td width="43" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2">Cr-4</span></td>
<td width="43" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2">Cr-6</span></td>
<td width="43" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2">Cr-7</span></td>
<td width="43" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2">Cr-8</span></td>
<td width="43" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2">Cr-11</span></td>
<td width="43" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2">Cr-12</span></td>
<td width="78" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2 style5 style8">รวมรายจ่าย</span></td>
<td width="80" align="center" bordercolor="#0066CC" bgcolor="#FF9966" style="border:1px solid gray"><span class="style2 style5 style8">คงเหลือเงินสุทธิ</span></td>
</tr>
<?php
$i = 1;
while($row = mysql_fetch_array($result))
{
if($count==0)
{
?>
<tr bgcolor="#F7F7F7" >
<td align="center" bgcolor="#EBFAeE" ><font color="#996600" size="1" face="Tahoma">
<?=$i?>
</font></td>
<td align="center" bgcolor="#EBFAeE" ><font size="2" face="Tahoma"><font color="#003366" size="2" face="Tahoma">
<?php
echo "$row[Teacher_id]";
?>
</font></font></td>
<td align="center" bgcolor="#EBFAeE" >
<div align="left">
<?php
$Teacher_code = $row["Teacher_code"];
$sql = "Select * From personal_tb Where Teacher_code='$Teacher_code'";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rss = mysql_fetch_array($result1);
echo "$rss[First_name] $rss[Teacher_name] $rss[Teacher_lastname]";
?>
</div>
<div align="left"></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#993333" size="2" face="Tahoma"><?echo number_format($row['Salary_1'],2,'.',','); ?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#993333" size="2" face="Tahoma"><?echo number_format($row['Salary_3'],2,'.',','); ?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#993333" size="2" face="Tahoma"><?echo number_format($row['Salary_3'],2,'.',','); ?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#993333" size="2" face="Tahoma"><?echo number_format($row['Costt_salary'],2,'.',','); ?></font><font color="#003366" size="2" face="Tahoma"> </font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#993333" size="2" face="Tahoma"><?echo number_format($row['Costt_11'],2,'.',','); ?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#993333" size="2" face="Tahoma"><?echo number_format($row['Costt_11'],2,'.',','); ?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#993333" size="2" face="Tahoma"><?echo number_format($row['Costt_to'],2,'.',','); ?></font></div></td>
<td bordercolor="#FFFBFF" bgcolor="#EBFAeE"><div align="right"><font color="#993333" size="2" face="Tahoma"> </font><font color="#993333" size="2" face="Tahoma"><?echo number_format($row['Costt_total'],2,'.',','); ?></font></div></td>
</tr>
<?
$count=1;
}
else
{
?>
<tr bgcolor="#FFFFFF">
<td align="center" bordercolor="#FFFFFF" ><font color="#996600" size="1" face="Tahoma">
<?=$i?>
</font></td>
<td align="center" bordercolor="#FFFFFF" ><font size="2" face="Tahoma"><font color="#003366" size="2" face="Tahoma">
<?php
echo "$row[Teacher_id]";
?>
</font></font></td>
<td align="center" bordercolor="#FFFFFF" >
<div align="left">
<?php
$Teacher_code = $row["Teacher_code"];
$sql = "Select * From personal_tb Where Teacher_code='$Teacher_code'";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rss = mysql_fetch_array($result1);
echo "$rss[First_name] $rss[Teacher_name] $rss[Teacher_lastname]";
?>
</div></td>
<td bordercolor="#FFFFFF"><div align="right"><font color="#993333" size="2" face="Tahoma"><?echo number_format($row['Salary_1'],2,'.',','); ?></font></div></td>
<td bordercolor="#FFFFFF"><div align="right"><font color="#993333" size="2" face="Tahoma"><?echo number_format($row['Salary_3'],2,'.',','); ?></font></div></td>
<td bordercolor="#FFFFFF"><div align="right"><font color="#993333" size="2" face="Tahoma"><?echo number_format($row['Salary_3'],2,'.',','); ?></font></div></td>
<td bordercolor="#FFFFFF"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFFFF"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFFFF"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFFFF"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFFFF"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFFFF"><div align="right"><font color="#993333" size="2" face="Tahoma"><?echo number_format($row['Costt_salary'],2,'.',','); ?></font></div></td>
<td bordercolor="#FFFFFF" bgcolor="#FFFFFF"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFFFF" bgcolor="#FFFFFF"><div align="right"><font color="#993333" size="2" face="Tahoma"><?echo number_format($row['Costt_11'],2,'.',','); ?></font></div></td>
<td bordercolor="#FFFFFF" bgcolor="#FFFFFF"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFFFF" bgcolor="#FFFFFF"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFFFF" bgcolor="#FFFFFF"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFFFF" bgcolor="#FFFFFF"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFFFF" bgcolor="#FFFFFF"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFFFF" bgcolor="#FFFFFF"><div align="right"><font color="#003366" face="Tahoma"><?php echo $rs[Costt_1] ;?></font></div></td>
<td bordercolor="#FFFFFF" bgcolor="#FFFFFF"><div align="right"><font color="#993333" size="2" face="Tahoma"><?echo number_format($row['Costt_11'],2,'.',','); ?></font></div></td>
<td bordercolor="#FFFFFF"><div align="right"><font color="#993333" size="2" face="Tahoma"><?echo number_format($row['Costt_to'],2,'.',','); ?></font></div></td>
<td bordercolor="#FFFFFF" ><div align="right"><font color="#993333" size="2" face="Tahoma"> </font><font color="#993333" size="2" face="Tahoma"><?echo number_format($row['Costt_total'],2,'.',','); ?></font></div></td>
</tr>
<?
$count=0;
}
$i++;
}
?>
<tr bgcolor="#FFFFFF">
<td align="center" bgcolor="#eeeeee" > </td>
<td align="center" bgcolor="#eeeeee" > </td>
<td align="center" bgcolor="#eeeeee" ><span class="style4">รวมเงิน</span></td>
<td align="center" bgcolor="#eeeeee" ><div align="right"><font color="#993333" size="2" face="Tahoma">
<?php
$sql7 = "Select Sum(Salary_1) as SumC7 From salary_repot_tb Where Start_mont='$Start_mont' and Start_year='$Start_year' and Person_type='$Person_type' ";
$result7 = mysql_query($sql7) or die("Erro".mysql_error());
$rss7 = mysql_fetch_array($result7);
echo number_format($rss7[SumC7],2,'.',',');
//echo"$rss5[SumC5]";
?>
</font></div></td>
<td align="center" bgcolor="#eeeeee" ><div align="right"><font color="#993333" size="2" face="Tahoma">
<?php
$sql6 = "Select Sum(Salary_3) as SumC8 From salary_repot_tb Where Start_mont='$Start_mont' and Start_year='$Start_year' and Person_type='$Person_type' ";
$result6 = mysql_query($sql6) or die("Erro".mysql_error());
$rss6 = mysql_fetch_array($result6);
echo number_format($rss6[SumC8],2,'.',',');
//echo"$rss5[SumC5]";
?>
</font></div></td>
<td align="center" bgcolor="#eeeeee" > </td>
<td align="center" bgcolor="#eeeeee" > </td>
<td align="center" bgcolor="#eeeeee" > </td>
<td align="center" bgcolor="#eeeeee" > </td>
<td align="center" bgcolor="#eeeeee" > </td>
<td align="center" bgcolor="#eeeeee" > </td>
<td align="center" bgcolor="#eeeeee" ><div align="right"><font color="#993333" size="2" face="Tahoma">
<?php
$sql6 = "Select Sum(Costt_salary) as SumC6 From salary_repot_tb Where Start_mont='$Start_mont' and Start_year='$Start_year' and Person_type='$Person_type' ";
$result6 = mysql_query($sql6) or die("Erro".mysql_error());
$rss6 = mysql_fetch_array($result6);
echo number_format($rss6[SumC6],2,'.',',');
//echo"$rss5[SumC5]";
?>
</font></div></td>
<td align="center" bgcolor="#eeeeee" > </td>
<td align="center" bgcolor="#eeeeee" ><div align="right"><font color="#993333" size="2" face="Tahoma">
<?php
$sql6 = "Select Sum(Costt_11) as SumC7 From salary_repot_tb Where Start_mont='$Start_mont' and Start_year='$Start_year' and Person_type='$Person_type' ";
$result6 = mysql_query($sql6) or die("Erro".mysql_error());
$rss6 = mysql_fetch_array($result6);
echo number_format($rss6[SumC7],2,'.',',');
//echo"$rss5[SumC5]";
?>
</font></div></td>
<td align="center" bgcolor="#eeeeee" > </td>
<td align="center" bgcolor="#eeeeee" > </td>
<td align="center" bgcolor="#eeeeee" > </td>
<td align="center" bgcolor="#eeeeee" > </td>
<td align="center" bgcolor="#eeeeee" > </td>
<td align="center" bgcolor="#eeeeee" > </td>
<td align="center" bgcolor="#eeeeee" ><font color="#993333" size="2" face="Tahoma">
<?php
$sql6 = "Select Sum(Costt_11) as SumC7 From salary_repot_tb Where Start_mont='$Start_mont' and Start_year='$Start_year' and Person_type='$Person_type' ";
$result6 = mysql_query($sql6) or die("Erro".mysql_error());
$rss6 = mysql_fetch_array($result6);
echo number_format($rss6[SumC7],2,'.',',');
//echo"$rss5[SumC5]";
?>
</font></td>
<td align="center" bgcolor="#eeeeee" ><div align="right"><font color="#993333" size="2" face="Tahoma">
<?php
$sql5 = "Select Sum(Costt_to) as SumC5 From salary_repot_tb Where Start_mont='$Start_mont' and Start_year='$Start_year' and Person_type='$Person_type' ";
$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 align="center" bgcolor="#eeeeee" ><div align="right"><strong><font color="#993333" size="2" face="Tahoma">
<?php
$sql = "Select Sum(Costt_total) as Sum From salary_repot_tb Where Start_mont='$Start_mont' and Start_year='$Start_year' and Person_type='$Person_type' ";
$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>
</tr>
<tr bgcolor="#CCCCFF">
<td colspan="23" align="center" bgcolor="#FFFFFF" ><div align="center"><span class="style1"><font color="#000000" face="Tahoma">ทั้งหมด</font><font color="#003399" face="Tahoma"> <? echo $num ?> </font><font color="#FFFFFF" face="Tahoma"><font color="#003366">รายการ</font><font color="#FFFFFF"> </font></font></span> </div></td>
</tr>
</table>
</form>
</div>
</label>
</fieldset><br>
<font color="<?php echo $GLOBALS["COLOR_FONT_3"];?>" size="2"><b>หมายเหตุ :</b><br>
</font></td>
</tr>
</table>
|