|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /home/pathumthani_integration/integration/application/industry/ |
Upload File : |
<? session_start() ;
header("Content-Type: text/html; charset=windows-874");
set_time_limit(0) ;
include_once("../../config/config_epm.inc.php");
include_once("manage_user.inc.php");
include_once("function/function.inc.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620" />
<title><?=$title_name?></title>
<script language="javascript">
function mOvr(src,clrOver){
if (!src.contains(event.fromElement)) src.bgColor = clrOver;
}
function mOut(src,clrIn){
if (!src.contains(event.toElement)) src.bgColor = clrIn;
}
</script>
<style type="text/css">
<!--
A:link {
FONT-SIZE: 12px;color: #000000; FONT-FAMILY: Tahoma, "Microsoft Sans Serif";TEXT-DECORATION: underline;FONT-WEIGHT: bold; text-decoration:none;
}
A:visited {
FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Tahoma, "Microsoft Sans Serif"; TEXT-DECORATION: underline;FONT-WEIGHT: bold;text-decoration:none;
}
A:active {
FONT-SIZE: 12px; COLOR: #014d5f; FONT-FAMILY: Tahoma, "Microsoft Sans Serif"; TEXT-DECORATION: underline;FONT-WEIGHT: bold;text-decoration:none;
}
A:hover {
FONT-SIZE: 12px; COLOR: #f3960b; FONT-FAMILY: Tahoma, "Microsoft Sans Serif"; TEXT-DECORATION: underline;FONT-WEIGHT: bold;text-decoration:none;
}
.h_menu {color:#FF9900}
-->
.bg_th{
background-image:url(images/horiz-bg.png);
background-repeat:repeat-x;
background-color:#305086;
font-weight:bold;
color:#FFFFFF;
text-align:center;
text-decoration: none;
}
.bg_th1{
background-repeat:repeat-x;
background-color:#355790;
font-weight:bold;
color:#FFFFFF;
text-align:center;
}
.style1 {
font-size: 18px;
font-weight: bold;
}
</style>
<script language=JavaScript>
function Conf(object) {
if (confirm("แน่ใจว่าจะลบข้อมูล")==true) {
return true;
}
return false;
}
function CheckIsIE()
{
if (navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER') { return true;}
else { return false; }
}
function PrintThisPage()
{
if (CheckIsIE() == true)
{
parent.iframe1.focus();
parent.iframe1.print();
}
else
{
window.frames['iframe1'].focus();
window.frames['iframe1'].print();
}
}
</script>
</head>
<body>
<?
include("header.php");
if($_GET['year_start']){
$year_start=$_GET['year_start'];
}else{
$year_start=date('Y')+543;
}
if($_GET['year_end']){
$year_end=$_GET['year_end'];
}else{
$year_end=date('Y')+543;
}
?>
<br />
<table width="99%" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td align="center"><strong style="color:#000033; font-size:16px;">รายงานข้อมูลรายชื่อบริษัทที่ได้รับส่งเสริมการลงทุน</strong></td>
</tr>
</table>
<br />
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" align="center">
<table width="65%" border="0" bgcolor="#CCCCCC" cellpadding="3" cellspacing="1">
<tr class="bg_th">
<td align="center" width="200"></td>
<td align="center" width="150"><strong>ปี พ.ศ. <?=$year_start?></strong></td>
<td align="center" width="150"><strong>ปี พ.ศ. <?=$year_end?></strong></td>
<td align="center" width="100"><strong>ร้อยละที่เพิ่มขึ้น</strong></td>
</tr>
<?
$sqlCompair1="SELECT COUNT(code) AS ALL_INDUSTRY,
SUM(capital) AS ALL_CAPITAL,
SUM(men) AS ALL_MEN
FROM industry_register
WHERE fyear='".$year_start."' and boi='1'
";
$rsCompair1=mysql_db_query($dbname,$sqlCompair1);
$resCompair1=mysql_fetch_assoc($rsCompair1);
//echo $sqlCompair1;
$sqlCompair2="SELECT COUNT(code) AS ALL_INDUSTRY,
SUM(capital) AS ALL_CAPITAL,
SUM(men) AS ALL_MEN
FROM industry_register
WHERE fyear='".$year_end."' and boi='1'
";
$rsCompair2=mysql_db_query($dbname,$sqlCompair2);
$resCompair2=mysql_fetch_assoc($rsCompair2);
if($resCompair1['ALL_INDUSTRY']==0){
$percenIndustry=0;
}else{
$percenIndustry=(($resCompair2['ALL_INDUSTRY']-$resCompair1['ALL_INDUSTRY'])/$resCompair1['ALL_INDUSTRY'])*100;
}
if($resCompair1['ALL_CAPITAL']==0){
$percenCapital=0;
}else{
$percenCapital=(($resCompair2['ALL_CAPITAL']-$resCompair1['ALL_CAPITAL'])/$resCompair1['ALL_CAPITAL'])*100;
}
if($resCompair1['ALL_MEN']==0){
$percenMen=0;
}else{
$percenMen=(($resCompair2['ALL_MEN']-$resCompair1['ALL_MEN'])/$resCompair1['ALL_MEN'])*100;
}
if($resCompair1['ALL_INDUSTRY']<$resCompair2['ALL_INDUSTRY']){
$imgIndustry='<img src="img/delta_up.png" width="14" height="14" align="top" />';
}else if($resCompair1['ALL_INDUSTRY']>$resCompair2['ALL_INDUSTRY']){
$imgIndustry='<img src="img/delta_down.png" width="14" height="14" align="top" />';
}else{
$imgIndustry='<img src="img/equal_symbol.png" width="14" height="14" align="top" />';
}
if($resCompair1['ALL_CAPITAL']<$resCompair2['ALL_CAPITAL']){
$imgCapital='<img src="img/delta_up.png" width="14" height="14" align="top" />';
}else if($resCompair1['ALL_CAPITAL']>$resCompair2['ALL_CAPITAL']){
$imgCapital='<img src="img/delta_down.png" width="14" height="14" align="top" />';
}else{
$imgCapital='<img src="img/equal_symbol.png" width="14" height="14" align="top" />';
}
if($resCompair1['ALL_MEN']<$resCompair2['ALL_MEN']){
$imgMen='<img src="img/delta_up.png" width="14" height="14" align="top" />';
}else if($resCompair1['ALL_MEN']>$resCompair2['ALL_MEN']){
$imgMen='<img src="img/delta_down.png" width="14" height="14" align="top" />';
}else{
$imgMen='<img src="img/equal_symbol.png" width="14" height="14" align="top" />';
}
?>
<tr bgcolor="#FFFFFF">
<td align="left"><strong>จำนวนโรงงาน (โรง)</strong></td>
<td align="right"><?=number_format($resCompair1['ALL_INDUSTRY'])?></td>
<td align="right"><?=number_format($resCompair2['ALL_INDUSTRY'])?></td>
<td align="right"><?=number_format($percenIndustry,2)?> % <?=$imgIndustry?></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="left"><strong>จำนวนเงินลงทุน (ล้านบาท)</strong></td>
<td align="right"><?=number_format(replaceToNumber(chkMilion($resCompair1['ALL_CAPITAL'])),2)?></td>
<td align="right"><?=number_format(replaceToNumber(chkMilion($resCompair2['ALL_CAPITAL'])),2)?></td>
<td align="right"><?=number_format($percenCapital,2)?> % <?=$imgCapital?></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="left"><strong>จำนวนคนงาน (คน)</strong></td>
<td align="right"><?=number_format($resCompair1['ALL_MEN'])?></td>
<td align="right"><?=number_format($resCompair2['ALL_MEN'])?></td>
<td align="right"><?=number_format($percenMen,2)?> % <?=$imgMen?></td>
</tr>
</table>
</td>
<td width="20"></td>
</tr>
</table>
<script src="common/gs_sortable.js"></script>
<link href="common/gs_sortable.css" />
<table width="99%" border="0" align="center" cellpadding="3" cellspacing="1" id="my_table5">
<tr>
<td width="12%"></td>
<td width="9%" align="left"></td>
<td width="79%" align="right">
<a href="?all=<?=($_GET['all']=='')?'1':''?>"><?=($_GET['compair']=='')?($_GET['all']=='')?'[แสดงทั้งหมด]':'[แสดงปกติ]':''?></a>
<a href="?year_start=<?=$_GET['year_start']?>&year_end=<?=$_GET['year_end']?>&compair=<?=($_GET['compair']=='')?'1':''?>"><?=($_GET['compair']=='')?'[แสดงรายงานแบบ 2 ปี]':'[แสดงรายงานแบบปกติ]'?></a>
<a href="http://www.boi.go.th/thai/about/form_promoted_companies.asp" target="_blank">[WEB BOI]</a></td>
</tr>
</table>
<table width="99%" border="0" align="center" bgcolor="#CCCCCC" cellpadding="3" cellspacing="1" id="my_table1">
<thead>
<tr class="bg_th">
<th width="40" rowspan="2" align="center"><strong>ลำดับที่</strong></th>
<td colspan="5">
<div><span style=" float:left"><a href="?year_start=<?=($year_start-1)?>&year_end=<?=$year_end?>&compair=<?=$_GET['compair']?>"><?=($_GET['all']=='')?'<img src="img/back.jpg" border="0" width="20" height="20" align="absmiddle" />':''?></a></span>
<span style="float:center"><font color="#FFFFFF"><strong>ปี พ.ศ. <?=($_GET['all']=='')?$year_start:''?></strong></font></span>
<span style="float:right"><a href="?year_start=<?=($year_start+1)?>&year_end=<?=$year_end?>&compair=<?=$_GET['compair']?>"><?=($year_start==(date('Y')+543) || $year_end==$year_start)?'':'<img src="img/next.jpg" border="0" width="20" height="20" align="absmiddle" />'?></a></span></div>
<?php /*?><table width="100%" border="0" cellpadding="0" cellspacing="0" id="my_table3">
<tr>
<td width="20" align="left"><a href="?year_start=<?=($year_start-1)?>&year_end=<?=$year_end?>&compair=<?=$_GET['compair']?>"><img src="img/back.jpg" border="0" width="20" height="20" align="absmiddle" /></a></td>
<td align="center"><font color="#FFFFFF"><strong>ปี พ.ศ. <?=$year_start?></strong></font></td>
<td width="20" align="right"><a href="?year_start=<?=($year_start+1)?>&year_end=<?=$year_end?>&compair=<?=$_GET['compair']?>"><?=($year_start==(date('Y')+543) || $year_end==$year_start)?'':'<img src="img/next.jpg" border="0" width="20" height="20" align="absmiddle" />'?></a></td>
</tr>
</table><?php */?>
</td>
<?
if($_GET['compair']){
?>
<td colspan="5">
<div><span style=" float:left"><a href="?year_start=<?=$year_start?>&year_end=<?=($year_end-1)?>&compair=<?=$_GET['compair']?>"><?=($year_end==$year_start)?'':'<img src="img/back.jpg" border="0" width="20" height="20" align="absmiddle" />'?></a></span>
<span style="float:center"><font color="#FFFFFF"><strong>ปี พ.ศ. <?=$year_end?></strong></font></span>
<span style="float:right"><a href="?year_start=<?=$year_start?>&year_end=<?=($year_end+1)?>&compair=<?=$_GET['compair']?>"><?=($year_end==(date('Y')+543))?'':'<img src="img/next.jpg" border="0" width="20" height="20" align="absmiddle" />'?></a></span></div>
<?php /*?><table width="100%" border="0" cellpadding="0" cellspacing="0" id="my_table4">
<tr>
<td width="20" align="left"><a href="?year_start=<?=$year_start?>&year_end=<?=($year_end-1)?>&compair=<?=$_GET['compair']?>"><?=($year_end==$year_start)?'':'<img src="img/back.jpg" border="0" width="20" height="20" align="absmiddle" />'?></a></td>
<td align="center"><font color="#FFFFFF"><strong>ปี พ.ศ. <?=$year_end?></strong></font></td>
<td width="20" align="right"><a href="?year_start=<?=$year_start?>&year_end=<?=($year_end+1)?>&compair=<?=$_GET['compair']?>"><?=($year_end==(date('Y')+543))?'':'<img src="img/next.jpg" border="0" width="20" height="20" align="absmiddle" />'?></a></td>
</tr>
</table><?php */?>
</td>
<? }?>
</tr>
<tr class="bg_th1">
<th width="90" align="center"><font color="#FFFFFF"><strong>ชื่อบริษัท</strong></font></th>
<th width="90" align="center"><font color="#FFFFFF"><strong>ที่ตั้งสำนักงาน</strong></font></th>
<th width="90" align="center"><font color="#FFFFFF"><strong>ที่ตั้งโรงงาน</strong></font></th>
<th width="90" align="center"><font color="#FFFFFF"><strong>จำนวนเงินลงทุน<br>(ล้านบาท)</strong></font></th>
<th width="90" align="center"><font color="#FFFFFF"><strong>จำนวนคนงาน (คน)</strong></font></th>
<?
if($_GET['compair']){
?>
<th width="90" align="center"><font color="#FFFFFF"><strong>ชื่อบริษัท</strong></font></th>
<th width="90" align="center"><font color="#FFFFFF"><strong>ที่ตั้งสำนักงาน</strong></font></th>
<th width="90" align="center"><font color="#FFFFFF"><strong>ที่ตั้งโรงงาน</strong></font></th>
<th width="90" align="center"><font color="#FFFFFF"><strong>จำนวนเงินลงทุน<br>(ล้านบาท)</strong></font></th>
<th width="90" align="center"><font color="#FFFFFF"><strong>จำนวนคนงาน (คน)</strong></font></th>
<? }?>
</tr>
</thead>
<tbody>
<?
$i=0;
$totalALL_CAPITAL_1=0;
$totalALL_MEN_1=0;
$totalALL_CAPITAL_2=0;
$totalALL_MEN_2=0;
$sqlTable_1="SELECT
SUM(capital) AS ALL_CAPITAL,
SUM(men) AS ALL_MEN,
prename,aname,lname,officeadd1,office_tam,office_amp,office_wat,office_zip,office_tel,location,tambol,ampur,code
FROM industry_register
WHERE boi='1'
";
if($_GET['all']==''){
$sqlTable_1.=" and fyear='".$year_start."' ";
}
$sqlTable_1.=" GROUP By code ";
//echo $sqlTable_1.'<hr>'; exit();
$rsTable_1=mysql_db_query($dbname,$sqlTable_1);
while($resTable_1=mysql_fetch_assoc($rsTable_1)){
$totalALL_CAPITAL_1+=replaceToNumber(chkMilion($resTable_1['ALL_CAPITAL']));
$totalALL_MEN_1+=$resTable_1['ALL_MEN'];
$nameOffice=$resTable_1['prename'].' '.$resTable_1['aname'].' '.$resTable_1['lname'];
if(substr($resTable_1['office_tam'],0,2)=='ต.' || substr($resTable_1['office_tam'],0,4)=='ตำบล'){
$nameOfficeTambol=$resTable_1['office_tam'];
}else if($resTable_1['office_tam']==''){
$nameOfficeTambol='';
}else{
$nameOfficeTambol='ต.'.$resTable_1['office_tam'];
}
if(substr($resTable_1['office_amp'],0,2)=='อ.' || substr($resTable_1['office_amp'],0,5)=='อำเภอ'){
$nameOfficeAmphur=$resTable_1['office_amp'];
}else if($resTable_1['office_amp']==''){
$nameOfficeAmphur='';
}else{
$nameOfficeAmphur='อ.'.$resTable_1['office_amp'];
}
if(substr($resTable_1['office_wat'],0,2)=='จ.' || substr($resTable_1['office_wat'],0,7)=='จังหวัด'){
$nameOfficeWat=$resTable_1['office_wat'];
}else if($resTable_1['office_wat']==''){
$nameOfficeWat='';
}else{
$nameOfficeWat='จ.'.$resTable_1['office_wat'];
}
$locationOffice=$resTable_1['officeadd1'].' '.$nameOfficeTambol.' '.$nameOfficeAmphur.' '.$nameOfficeWat.' '.$resTable_1['office_zip'].' โทร.'.$resTable_1['office_tel'];
if(substr($resTable_1['tambol'],0,2)=='ต.' || substr($resTable_1['tambol'],0,4)=='ตำบล'){
$nameIndustryTambol=$resTable_1['tambol'];
}else if($resTable_1['tambol']==''){
$nameIndustryTambol='';
}else{
$nameIndustryTambol='ต.'.$resTable_1['tambol'];
}
if(substr($resTable_1['ampur'],0,2)=='อ.' || substr($resTable_1['ampur'],0,5)=='อำเภอ'){
$nameIndustryAmphur=$resTable_1['ampur'];
}else if($resTable_1['ampur']==''){
$nameIndustryAmphur='';
}else{
$nameIndustryAmphur='อ.'.$resTable_1['ampur'];
}
$locationIndustry=$resTable_1['location'].' '.$nameIndustryTambol.' '.$nameIndustryAmphur.' จ.ปทุมธานี';
$arrData1_1[]=$nameOffice;
$arrData1_2[]=$locationOffice;
$arrData1_3[]=$locationIndustry;
$arrData1_4[]=replaceToNumber(chkMilion($resTable_1['ALL_CAPITAL']));
$arrData1_5[]=$resTable_1['ALL_MEN'];
}
$sqlTable_2="SELECT
SUM(capital) AS ALL_CAPITAL,
SUM(men) AS ALL_MEN,
prename,aname,lname,officeadd1,office_tam,office_amp,office_wat,office_zip,office_tel,location,tambol,ampur,code
FROM industry_register
WHERE fyear='".$year_end."' and boi='1'
GROUP By code
";
//echo $sqlTable_1.'<hr>'; exit();
$rsTable_2=mysql_db_query($dbname,$sqlTable_2);
while($resTable_2=mysql_fetch_assoc($rsTable_2)){
$totalALL_CAPITAL_2+=replaceToNumber(chkMilion($resTable_2['ALL_CAPITAL']));
$totalALL_MEN_2+=$resTable_2['ALL_MEN'];
$nameOffice=$resTable_2['prename'].' '.$resTable_2['aname'].' '.$resTable_2['lname'];
if(substr($resTable_2['office_tam'],0,2)=='ต.' || substr($resTable_2['office_tam'],0,4)=='ตำบล'){
$nameOfficeTambol=$resTable_2['office_tam'];
}else if($resTable_2['office_tam']==''){
$nameOfficeTambol='';
}else{
$nameOfficeTambol='ต.'.$resTable_2['office_tam'];
}
if(substr($resTable_2['office_amp'],0,2)=='อ.' || substr($resTable_2['office_amp'],0,5)=='อำเภอ'){
$nameOfficeAmphur=$resTable_2['office_amp'];
}else if($resTable_2['office_amp']==''){
$nameOfficeAmphur='';
}else{
$nameOfficeAmphur='อ.'.$resTable_2['office_amp'];
}
if(substr($resTable_2['office_wat'],0,2)=='จ.' || substr($resTable_2['office_wat'],0,7)=='จังหวัด'){
$nameOfficeWat=$resTable_2['office_wat'];
}else if($resTable_2['office_wat']==''){
$nameOfficeWat='';
}else{
$nameOfficeWat='จ.'.$resTable_2['office_wat'];
}
$locationOffice=$resTable_2['officeadd1'].' '.$nameOfficeTambol.' '.$nameOfficeAmphur.' '.$nameOfficeWat.' '.$resTable_2['office_zip'].' โทร.'.$resTable_2['office_tel'];
if(substr($resTable_2['tambol'],0,2)=='ต.' || substr($resTable_2['tambol'],0,4)=='ตำบล'){
$nameIndustryTambol=$resTable_2['tambol'];
}else if($resTable_2['tambol']==''){
$nameIndustryTambol='';
}else{
$nameIndustryTambol='ต.'.$resTable_2['tambol'];
}
if(substr($resTable_2['ampur'],0,2)=='อ.' || substr($resTable_2['ampur'],0,5)=='อำเภอ'){
$nameIndustryAmphur=$resTable_2['ampur'];
}else if($resTable_2['ampur']==''){
$nameIndustryAmphur='';
}else{
$nameIndustryAmphur='อ.'.$resTable_2['ampur'];
}
$locationIndustry=$resTable_2['location'].' '.$nameIndustryTambol.' '.$nameIndustryAmphur.' จ.ปทุมธานี';
$arrData2_1[]=$nameOffice;
$arrData2_2[]=$locationOffice;
$arrData2_3[]=$locationIndustry;
$arrData2_4[]=replaceToNumber(chkMilion($resTable_2['ALL_CAPITAL']));
$arrData2_5[]=$resTable_2['ALL_MEN'];
}
$num_1=count($arrData1_1);
$num_2=count($arrData2_1);
if($_GET['compair']){
if($num_1>$num_2){
$numVa=$num_1;
}else{
$numVa=$num_2;
}
}else{
$numVa=$num_1;
}
for($i=0;$i<$numVa;$i++){
?>
<tr bgcolor="#FFFFFF">
<td align="center"><?=($i+1)?></td>
<td align="left"><?=($arrData1_1[$i]=='')?'N/A':$arrData1_1[$i]?></td>
<td align="left"><?=($arrData1_2[$i]=='')?'N/A':$arrData1_2[$i]?></td>
<td align="left"><?=($arrData1_3[$i]=='')?'N/A':$arrData1_3[$i]?></td>
<td align="right"><?=($arrData1_4[$i]=='')?'N/A':number_format($arrData1_4[$i],2)?></td>
<td align="right"><?=($arrData1_5[$i]=='')?'N/A':number_format($arrData1_5[$i])?></td>
<?
if($_GET['compair']){
?>
<td align="left"><?=($arrData2_1[$i]=='')?'N/A':$arrData2_1[$i]?></td>
<td align="left"><?=($arrData2_2[$i]=='')?'N/A':$arrData2_2[$i]?></td>
<td align="left"><?=($arrData2_3[$i]=='')?'N/A':$arrData2_3[$i]?></td>
<td align="right"><?=($arrData2_4[$i]=='')?'N/A':number_format($arrData2_4[$i],2)?></td>
<td align="right"><?=($arrData2_5[$i]=='')?'N/A':number_format($arrData2_5[$i])?></td>
<? }?>
</tr>
<? }?>
</tbody>
<tfoot>
<tr bgcolor="#DDDDDD">
<td colspan="4" align="right"><strong>รวม </strong></td>
<td align="right"><strong><?=number_format($totalALL_CAPITAL_1,2)?></strong></td>
<td align="right"><strong><?=number_format($totalALL_MEN_1)?></strong></td>
<?
if($_GET['compair']){
?>
<td colspan="3" align="right"><strong>รวม </strong></td>
<td align="right"><strong><?=number_format($totalALL_CAPITAL_2,2)?></strong></td>
<td align="right"><strong><?=number_format($totalALL_MEN_2)?></strong></td>
<? }?>
</tr>
</tfoot>
</table>
<script type="text/javascript">
<!--
var TSort_Data = new Array ('my_table1', '', 'h','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g');
var TSort_Classes = new Array ('row1', 'row2');
tsRegister();
// -->
</script>
<br>
</body>
</html>