MINI SHELL

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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/pathumthani_integration/integration/application/industry/report_industry.php
<? 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"); 
?>
<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="50%" border="0" bgcolor="#CCCCCC" cellpadding="3" cellspacing="1">
				<tr class="bg_th">
						<td align="center"><strong>ประเภท</strong></td>
						<td align="center"><strong>จำนวนโรงงาน<br />(โรง)</strong></td>
						<td align="center"><strong>จำนวนเงินลงทุน <br />(ล้านบาท)</strong></td>
						<td align="center"><strong>จำนวนคนงาน<br /> (คน)</strong></td>
				</tr>
				<?
				$strSQL_3 = "SELECT *												
										FROM		industry_type
										WHERE parent_id='0'
								";
				$rsConn_3 = mysql_db_query($dbname,$strSQL_3);
				$data1='';
				$data2='';
				$data3='';
				$data4='';
				$data5='';
				$totalALL_INDUSTRY=0;
				$totalALL_CAPITAL=0;
				$totalALL_MEN=0;
				$totalACTIVE_INDUSTRY=0;
				$totalACTIVE_CAPITAL=0;
				$totalACTIVE_MEN=0;
				$totalNONACTIVE_INDUSTRY=0;
				$totalNONACTIVE_CAPITAL=0;
				$totalNONACTIVE_MEN=0;
				$catagory='';
				while ( $Result_3 = mysql_fetch_assoc($rsConn_3)) {
					$catagory.=substr($Result_3['type_name'],10).';';
					$strSQL_3_1 = "SELECT *												
											FROM		industry_type
											WHERE parent_id='".$Result_3['runid']."'
									";
					$rsConn_3_1 = mysql_db_query($dbname,$strSQL_3_1);
					$str_no1='';
					while ( $Result_3_1 = mysql_fetch_assoc($rsConn_3_1)) {
							$str_no1.="'".$Result_3_1['type_id']."'".',';
					}
					$str_no1=substr($str_no1,0,strlen($str_no1)-1);
						$sqlClass1="SELECT COUNT(code) AS ALL_INDUSTRY,
															SUM(capital) AS ALL_CAPITAL,
															SUM(men) AS ALL_MEN,
															SUM(if(import_status!='4',1,0)) AS ACTIVE_INDUSTRY,
															SUM(if(import_status!='4',capital,0)) AS ACTIVE_CAPITAL,
															SUM(if(import_status!='4',men,0)) AS ACTIVE_MEN,
															SUM(if(import_status='4',1,0)) AS NONACTIVE_INDUSTRY,
															SUM(if(import_status='4',capital,0)) AS NONACTIVE_CAPITAL,
															SUM(if(import_status='4',men,0)) AS NONACTIVE_MEN
												FROM industry_register					
												WHERE 
											";
						if($str_no1==''){
							$sqlClass1.="	  type_id ='-999'	";	
						}else{
							$sqlClass1.="	  type_id IN($str_no1)	";	
						}
						//echo $sqlClass1;
						$rsClass1=mysql_db_query($dbname,$sqlClass1);
						$resClass1=mysql_fetch_assoc($rsClass1);
						
						$totalALL_INDUSTRY+=$resClass1['ALL_INDUSTRY'];
						$totalALL_CAPITAL+=$resClass1['ALL_CAPITAL'];
						$totalALL_MEN+=$resClass1['ALL_MEN'];
						$totalACTIVE_INDUSTRY+=$resClass1['ACTIVE_INDUSTRY'];
						$totalACTIVE_CAPITAL+=replaceToNumber(chkMilion($resClass1['ACTIVE_CAPITAL']));
						$totalACTIVE_MEN+=$resClass1['ACTIVE_MEN'];
						$totalNONACTIVE_INDUSTRY+=$resClass1['NONACTIVE_INDUSTRY'];
						$totalNONACTIVE_CAPITAL+=$resClass1['NONACTIVE_CAPITAL'];
						$totalNONACTIVE_MEN+=$resClass1['NONACTIVE_MEN'];
						$data1.=$resClass1['ACTIVE_INDUSTRY'].';';
						//$data2.=number_format((((int)$resClass1['ACTIVE_CAPITAL'])/1000000),3).';';
						$data2.=chkMilion($resClass1['ACTIVE_CAPITAL']).';';
						$data3.=$resClass1['ACTIVE_MEN'].';';						
				}
				$data1=substr($data1,0,strlen($data1)-1);
				$data2=substr($data2,0,strlen($data2)-1);
				$data3=substr($data3,0,strlen($data3)-1);
				$catagory=substr($catagory,0,strlen($catagory)-1);
				//$catagory=strtr($catagory,'อุตสาหกรรม','');
				//$totalACTIVE_CAPITAL=chkMilion($totalACTIVE_CAPITAL);
				$totalNONACTIVE_CAPITAL=chkMilion($totalNONACTIVE_CAPITAL);
				$data4.=$totalACTIVE_INDUSTRY.';'.$totalACTIVE_CAPITAL.';'.$totalACTIVE_MEN;
				$data5.=$totalNONACTIVE_INDUSTRY.';'.$totalNONACTIVE_CAPITAL.';'.$totalNONACTIVE_MEN;
				
				$data4_1=$totalACTIVE_INDUSTRY.';;';
				$data4_2=';'.$totalACTIVE_CAPITAL.';';
				$data4_3=';;'.$totalACTIVE_MEN;
				//$totalALL_CAPITAL=number_format(replaceToNumber($totalACTIVE_CAPITAL)+replaceToNumber($totalNONACTIVE_CAPITAL),2);
						//echo strtr ( "อุตสาหกรรมการพาณิชย์", "อุตสาหกรรม", "City" );
				?>
				<tr bgcolor="#FFFFFF">
						<td align="left"><strong>โรงงานในจังหวัดปทุมธานี</strong></td>
						<td align="right"><? if($totalACTIVE_INDUSTRY!=0){ ?><a href="show_industry.php?type=1&row=1&temp=1" target="_blank"><? }?><?=number_format($totalACTIVE_INDUSTRY)?></a></td>
						<td align="right"><? if($totalACTIVE_CAPITAL!=0){ ?><a href="show_industry.php?type=1&row=2&temp=1" target="_blank"><? }?><?=number_format($totalACTIVE_CAPITAL,2)?></a></td>
						<td align="right"><? if($totalACTIVE_MEN!=0){ ?><a href="show_industry.php?type=1&row=3&temp=1" target="_blank"><? }?><?=number_format($totalACTIVE_MEN)?></a></td>
				</tr>
                <?php /*?><tr bgcolor="#FFFFFF">
						<td align="left"><strong>เลิกกิจการ</strong></td>
						<td align="right"><? if($totalNONACTIVE_INDUSTRY!=0){ ?><a href="show_industry.php?type=1&row=1&temp=2" target="_blank"><? }?><?=number_format($totalNONACTIVE_INDUSTRY)?></a></td>
						<td align="right"><? if($totalNONACTIVE_CAPITAL!=0){ ?><a href="show_industry.php?type=1&row=2&temp=2" target="_blank"><? }?><?=$totalNONACTIVE_CAPITAL?></a></td>
						<td align="right"><? if($totalNONACTIVE_MEN!=0){ ?><a href="show_industry.php?type=1&row=3&temp=2" target="_blank"><? }?><?=number_format($totalNONACTIVE_MEN)?></a></td>
				</tr>
                <tr bgcolor="#DDDDDD">
						<td align="left"><strong>ทั้งหมด</strong></td>
						<td align="right"><? if($totalALL_INDUSTRY!=0){ ?><a href="show_industry.php?type=1&row=1&temp=" target="_blank"><? }?><?=number_format($totalALL_INDUSTRY)?></a></td>
						<td align="right"><? if($totalALL_CAPITAL!=0){ ?><a href="show_industry.php?type=1&row=2&temp=" target="_blank"><? }?><?=$totalALL_CAPITAL?></a></td>
						<td align="right"><? if($totalALL_MEN!=0){ ?><a href="show_industry.php?type=1&row=3&temp=" target="_blank"><? }?><?=number_format($totalALL_MEN)?></a></td>
				</tr><?php */?>
		</table>
		</td>
		<td width="20"></td>
		</tr>
		
		</table>
<?
if($show==''){
	/*echo '<pe>';
	print_r($resultArr);*/
?>	
<table width="99%" border="0" cellpadding="0" cellspacing="0">
		<tr><td>&nbsp;</td><td align="center">
        				<table width="99%" border="0" cellpadding="0" cellspacing="0"><tr><td width="51%"></td><td width="49%">
                        <a href="?show=1"><strong>[แสดงรายงาน]</strong></a>
                        </td></tr>
                        </table>
                        </td></tr>
        <tr><td>&nbsp;</td><td></td></tr>
		<tr>
        		<td valign="top"  align="center" width="400">
                <table  border="0" cellpadding="0" cellspacing="0" width="400" bgcolor="#000D70">
                	<tr><td>
                <?				
				//$catagory='จำพวก1;จำพวก2;จำพวก3';
				//$columntitle="รายงานข้อมูลโรงงานอุตสาหกรรมจำแนกตามจำพวก";
				$columntitle='กราฟแสดงจำนวนโรงงานจำแนกตามหมวดอุตสาหกรรม';
				//echo $catagory;
				//$graph_path = "http://202.129.35.106/graphservice/graphservice.php";  //Sapphire Graph
				//$catagory = 'ระดับความรุนแรงน้อย;ระดับความรุนแรงปานกลาง;ระดับความรุนแรงมาก';
				/*$w1=375;
				$h1=188;*/
				$w1=400;
				$h1=200;		
				
				$xgraphurl = $graph_path ."?category=$catagory"."&data1="."$data1"."&outputstyle=&numseries=1&seriesname=&graphtype=bar&title=$columntitle&xname=&yname=&subtitle=&graphstyle=srd_allvisible_lg.scs";//srd_sf_016
				
				$xgraphurl_link = $graph_path ."?category=$catagory"."&data1="."$data1"."&outputstyle=&numseries=1&seriesname=&graphtype=bar&title=$columntitle&xname=&yname=&subtitle=&graphstyle=srd_allvisible_lg.scs&xcontrol=1";//srd_sf_004
				?>
				<table width="100%" border="0">
                        <tr>
                                <td>&nbsp;</td>
                                <td align="right"><a href="<?=$xgraphurl_link?>" target="_blank"><img src="images/maximize.gif" align="absmiddle" border="0" /></a></td>
                        </tr>
				</table>
				<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="<?=$w1?>" height="<?=$h1?>" >
				<param name="movie" value="<?=$xgraphurl?>">
				<param name="quality" value="high">
				<param name="wmode" value="transparent">
				<embed src="<?=$xgraphurl?>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="<?=$w1?>" height="<?=$h1?>" wmode="transparent"></embed>
				</object>
                </td></tr></table>
                </td>
                <td valign="top"  align="center"  width="400">
                <table  border="0" cellpadding="0" cellspacing="0" width="400" bgcolor="#000D70">
                	<tr><td>
                <?
				//$catagory='t1;t2;t3';
				//$columntitle="รายงานข้อมูลโรงงานอุตสาหกรรมจำแนกตามจำพวก";
				$columntitle='กราฟแสดงจำนวนเงินลงทุนจำแนกตามหมวดอุตสาหกรรม (ล้านบาท)';
				//echo $catagory;
				//$graph_path = "http://202.129.35.106/graphservice/graphservice.php";  //Sapphire Graph
				//$catagory = 'ระดับความรุนแรงน้อย;ระดับความรุนแรงปานกลาง;ระดับความรุนแรงมาก';
				/*$w1=375;
				$h1=188;*/
				$w1=400;
				$h1=200;		
				
				$xgraphurl = $graph_path ."?category=$catagory"."&data1="."$data2"."&outputstyle=&numseries=1&seriesname=&graphtype=bar&title=$columntitle&xname=&yname=&subtitle=&graphstyle=srd_allvisible_lg_1.scs";
				
				$xgraphurl_link = $graph_path ."?category=$catagory"."&data1="."$data2"."&outputstyle=&numseries=1&seriesname=&graphtype=bar&title=$columntitle&xname=&yname=&subtitle=&graphstyle=srd_allvisible_lg_1.scs&xcontrol=1";//srd_sf_004
				?>
				<table width="100%" border="0">
                        <tr>
                                <td>&nbsp;</td>
                                <td align="right"><a href="<?=$xgraphurl_link?>" target="_blank"><img src="images/maximize.gif" align="absmiddle" border="0" /></a></td>
                        </tr>
				</table>
				<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="<?=$w1?>" height="<?=$h1?>" >
				<param name="movie" value="<?=$xgraphurl?>">
				<param name="quality" value="high">
				<param name="wmode" value="transparent">
				<embed src="<?=$xgraphurl?>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="<?=$w1?>" height="<?=$h1?>" wmode="transparent"></embed>
				</object>
                </td></tr></table>
                </td>
        </tr>
        <tr><td>&nbsp;</td><td></td></tr>
        <tr>
        		<td valign="top"  align="center"  width="400">
                <table  border="0" cellpadding="0" cellspacing="0" width="400" bgcolor="#000D70">
                	<tr><td>
                <?
				//$catagory='t1;t2;t3';
				//$columntitle="รายงานข้อมูลโรงงานอุตสาหกรรมจำแนกตามจำพวก";
				$columntitle='กราฟแสดงจำนวนคนงานจำแนกตามหมวดอุตสาหกรรม';
				//echo $catagory;
				//$graph_path = "http://202.129.35.106/graphservice/graphservice.php";  //Sapphire Graph
				//$catagory = 'ระดับความรุนแรงน้อย;ระดับความรุนแรงปานกลาง;ระดับความรุนแรงมาก';
				/*$w1=375;
				$h1=188;*/
				$w1=400;
				$h1=200;		
				
				$xgraphurl = $graph_path ."?category=$catagory"."&data1="."$data3"."&outputstyle=&numseries=1&seriesname=&graphtype=bar&title=$columntitle&xname=&yname=&subtitle=&graphstyle=srd_allvisible_lg.scs";
				
				$xgraphurl_link = $graph_path ."?category=$catagory"."&data1="."$data3"."&outputstyle=&numseries=1&seriesname=&graphtype=bar&title=$columntitle&xname=&yname=&subtitle=&graphstyle=srd_allvisible_lg.scs&xcontrol=1";//srd_sf_004
				?>
				<table width="100%" border="0">
                        <tr>
                                <td>&nbsp;</td>
                                <td align="right"><a href="<?=$xgraphurl_link?>" target="_blank"><img src="images/maximize.gif" align="absmiddle" border="0" /></a></td>
                        </tr>
				</table>
				<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="<?=$w1?>" height="<?=$h1?>" >
				<param name="movie" value="<?=$xgraphurl?>">
				<param name="quality" value="high">
				<param name="wmode" value="transparent">
				<embed src="<?=$xgraphurl?>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="<?=$w1?>" height="<?=$h1?>" wmode="transparent"></embed>
				</object>
                </td></tr></table>
                </td>
                <td valign="top"  align="center" width="400">
                <table  border="0" cellpadding="0" cellspacing="0" width="400" bgcolor="#000D70">
                	<tr><td>
                <?
				$catagory='จำนวนโรงงาน;จำนวนเงินลงทุน(ล้านบาท);จำนวนคน(คน)';
				//$seriesname='ยังดำเนินการอยู่;เลิกกิจการ';
				//$seriesname='ยังดำเนินการอยู่';
				//$columntitle="รายงานข้อมูลโรงงานอุตสาหกรรมจำแนกตามจำพวก";
				$columntitle='กราฟเปรียบเทียบโรงงานอุตสาหกรรมสถานะยังดำเนินกิจการอยู่';
				//echo $catagory;
				//$graph_path = "http://202.129.35.106/graphservice/graphservice.php";  //Sapphire Graph
				//$catagory = 'ระดับความรุนแรงน้อย;ระดับความรุนแรงปานกลาง;ระดับความรุนแรงมาก';
				/*$w1=375;
				$h1=188;*/
				$w1=400;
				$h1=200;		
				
				/*$xgraphurl = $graph_path ."?category=$catagory"."&data1="."$data4"."&data2="."$data5"."&outputstyle=&numseries=2&seriesname=$seriesname&graphtype=column&title=$columntitle&xname=&yname=&subtitle=&graphstyle=srd_allvisible_lg.scs";
				
				$xgraphurl_link = $graph_path ."?category=$catagory"."&data1="."$data4"."&data2="."$data5"."&outputstyle=&numseries=2&seriesname=$seriesname&graphtype=column&title=$columntitle&xname=&yname=&subtitle=&graphstyle=srd_allvisible_lg.scs";*/
				
				$xgraphurl = $graph_path ."?category=$catagory"."&data1="."$data4_1"."&data2="."$data4_2"."&data3="."$data4_3"."&outputstyle=&numseries=3&seriesname=$seriesname&graphtype=column&title=$columntitle&xname=&yname=&subtitle=&graphstyle=srd_allvisible_lg.scs";
				
				$xgraphurl_link = $graph_path ."?category=$catagory"."&data1="."$data4_1"."&data2="."$data4_2"."&data3="."$data4_3"."&outputstyle=&numseries=3&seriesname=$seriesname&graphtype=column&title=$columntitle&xname=&yname=&subtitle=&graphstyle=srd_allvisible_lg.scs";
				?>
				<table width="100%" border="0">
                        <tr>
                                <td>&nbsp;</td>
                                <td align="right"><a href="<?=$xgraphurl_link?>" target="_blank"><img src="images/maximize.gif" align="absmiddle" border="0" /></a></td>
                        </tr>
				</table>
				<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="<?=$w1?>" height="<?=$h1?>" >
				<param name="movie" value="<?=$xgraphurl?>">
				<param name="quality" value="high">
				<param name="wmode" value="transparent">
				<embed src="<?=$xgraphurl?>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="<?=$w1?>" height="<?=$h1?>" wmode="transparent"></embed>
				</object>
                </td></tr></table>
                </td>
        </tr>
        <tr><td>&nbsp;</td><td></td></tr>
</table>

<?
}
if($show=='1'){
?>		
<script src="common/gs_sortable.js"></script>
<link href="common/gs_sortable.css" />
<table width="99%" border="0" align="center" cellpadding="3" cellspacing="1">
				<tr>
                		<td>
                		</td>
						<td width="13%" align="left"></td>
						<td width="10%" align="right"><A href="report_industry_pdf.php?name=" target="_blank"><IMG src="img/pdf.gif" alt="ผลการค้นหา PDF" width="18" height="18" border="0" title="PDF" align="absmiddle"></A></td>
				</tr>
		</table>
        
		<table width="99%" border="0" align="center" bgcolor="#CCCCCC" cellpadding="3" cellspacing="1" id="my_table">
        	<thead>
				<tr class="bg_th">
				  <th width="40" align="center"><strong>ลำดับที่</strong></th>
				  <th width="120" 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>จำนวนเงินลงทุน<br>(ล้านบาท)</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>จำนวนโรงงาน<br>(โรง)</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>จำนวนคนงาน<br>(คน)</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>จำนวนเงินลงทุน<br>(ล้านบาท)</strong></font></th>
                        <th width="90" align="center"><font color="#FFFFFF"><strong>จำนวนคนงาน<br>(คน)</strong></font></th>-->
				</tr>
            </thead>
            <tbody>
				<?
				$strSQL_2 = "SELECT *												
										FROM		industry_type
										WHERE parent_id='0'
								";
				$rsConn_2 = mysql_db_query($dbname,$strSQL_2);
				$i=0;
				$totalALL_INDUSTRY=0;
				$totalALL_CAPITAL=0;
				$totalALL_MEN=0;
				$totalACTIVE_INDUSTRY=0;
				$totalACTIVE_CAPITAL=0;
				$totalACTIVE_MEN=0;
				$totalNONACTIVE_INDUSTRY=0;
				$totalNONACTIVE_CAPITAL=0;
				$totalNONACTIVE_MEN=0;
				while ( $Result_2 = mysql_fetch_assoc($rsConn_2)) {
						$i++;		
						$rowNumb = ($i+($board_link_num*$page)-$board_link_num);
						
						$strSQL_3_2 = "SELECT *												
												FROM		industry_type
												WHERE parent_id='".$Result_2['runid']."'
										";
						$rsConn_3_2 = mysql_db_query($dbname,$strSQL_3_2);
						$str_no2='';
						while ( $Result_3_2 = mysql_fetch_assoc($rsConn_3_2)) {
								$str_no2.="'".$Result_3_2['type_id']."'".',';
						}
						$str_no2=substr($str_no2,0,strlen($str_no2)-1);
						$sqlClass="SELECT COUNT(code) AS ALL_INDUSTRY,
															SUM(capital) AS ALL_CAPITAL,
															SUM(men) AS ALL_MEN,
															SUM(if(import_status!='4',1,0)) AS ACTIVE_INDUSTRY,
															SUM(if(import_status!='4',capital,0)) AS ACTIVE_CAPITAL,
															SUM(if(import_status!='4',men,0)) AS ACTIVE_MEN,
															SUM(if(import_status='4',1,0)) AS NONACTIVE_INDUSTRY,
															SUM(if(import_status='4',capital,0)) AS NONACTIVE_CAPITAL,
															SUM(if(import_status='4',men,0)) AS NONACTIVE_MEN
												FROM industry_register
												WHERE 
											";
						if($str_no2==''){
							$sqlClass.="	  type_id ='-999'	";	
						}else{
							$sqlClass.="	  type_id IN($str_no2)	";	
						}
						//echo $sqlClass.'<hr>';
						$rsClass=mysql_db_query($dbname,$sqlClass);
						$resClass=mysql_fetch_assoc($rsClass);
						
						$totalALL_INDUSTRY+=$resClass['ALL_INDUSTRY'];
						$totalALL_CAPITAL+=replaceToNumber(chkMilion($resClass['ALL_CAPITAL']));
						$totalALL_MEN+=$resClass['ALL_MEN'];
						$totalACTIVE_INDUSTRY+=$resClass['ACTIVE_INDUSTRY'];
						$totalACTIVE_CAPITAL+=replaceToNumber(chkMilion($resClass['ACTIVE_CAPITAL']));
						$totalACTIVE_MEN+=$resClass['ACTIVE_MEN'];
						$totalNONACTIVE_INDUSTRY+=$resClass['NONACTIVE_INDUSTRY'];
						$totalNONACTIVE_CAPITAL+=replaceToNumber(chkMilion($resClass['NONACTIVE_CAPITAL']));
						$totalNONACTIVE_MEN+=$resClass['NONACTIVE_MEN'];
						
				?>
				<tr bgcolor="#FFFFFF" onmouseover="this.style.backgroundColor='#dbf2ae'" onmouseout="this.style.backgroundColor='#FFFFFF'">
						<td align="center"><?=$rowNumb?></td>
						<td align="left"><?=$Result_2['type_name']?></td>
						<?php /*?><td align="right"><? if($resClass['ALL_INDUSTRY']!=0){ ?><a href="show_industry.php?type=<?=$Result_2['type_id']?>&row=1&temp=" target="_blank"><? }?><?=number_format($resClass['ALL_INDUSTRY'])?></a></td>
						<td align="right"><? if($resClass['ALL_CAPITAL']!=0){ ?><a href="show_industry.php?type=<?=$Result_2['type_id']?>&row=2&temp=" target="_blank"><? }?><?=chkMilion($resClass['ALL_CAPITAL'])?></a></td>
						<td align="right"><? if($resClass['ALL_MEN']!=0){ ?><a href="show_industry.php?type=<?=$Result_2['type_id']?>&row=3&temp=" target="_blank"><? }?><?=number_format($resClass['ALL_MEN'])?></a></td><?php */?>
						<td align="right"><? if($resClass['ACTIVE_INDUSTRY']!=0){ ?><a href="show_industry.php?type=<?=$Result_2['type_id']?>&row=1&temp=1" target="_blank"><? }?><?=number_format($resClass['ACTIVE_INDUSTRY'])?></a></td>
						<td align="right"><? if($resClass['ACTIVE_CAPITAL']!=0){ ?><a href="show_industry.php?type=<?=$Result_2['type_id']?>&row=2&temp=1" target="_blank"><? }?><?=chkMilion($resClass['ACTIVE_CAPITAL'])?></a></td>
						<td align="right"><? if($resClass['ACTIVE_MEN']!=0){ ?><a href="show_industry.php?type=<?=$Result_2['type_id']?>&row=3&temp=1" target="_blank"><? }?><?=number_format($resClass['ACTIVE_MEN'])?></a></td>
						<?php /*?><td align="right"><? if($resClass['NONACTIVE_INDUSTRY']!=0){ ?><a href="show_industry.php?type=<?=$Result_2['type_id']?>&row=1&temp=2" target="_blank"><? }?><?=number_format($resClass['NONACTIVE_INDUSTRY'])?></a></td>
						<td align="right"><? if($resClass['NONACTIVE_CAPITAL']!=0){ ?><a href="show_industry.php?type=<?=$Result_2['type_id']?>&row=2&temp=2" target="_blank"><? }?><?=chkMilion($resClass['NONACTIVE_CAPITAL'])?></a></td>
						<td align="right"><? if($resClass['NONACTIVE_MEN']!=0){ ?><a href="show_industry.php?type=<?=$Result_2['type_id']?>&row=3&temp=2" target="_blank"><? }?><?=number_format($resClass['NONACTIVE_MEN'])?></a></td><?php */?>
				</tr>
				<? }?>
          </tbody>
          <tfoot>
				<tr bgcolor="#DDDDDD">
						<td colspan="2" align="right"><strong>รวม&nbsp;</strong></td>
						<?php /*?><td align="right"><? if($totalALL_INDUSTRY!=0){ ?><a href="show_industry.php?type=1&row=1&temp=" target="_blank"><? }?><strong><?=number_format($totalALL_INDUSTRY)?></strong></a></td>
						<td align="right"><? if($totalALL_CAPITAL!=0){ ?><a href="show_industry.php?type=1&row=2&temp=" target="_blank"><? }?><strong><?=number_format($totalALL_CAPITAL,2)?></strong></a></td>
						<td align="right"><? if($totalALL_MEN!=0){ ?><a href="show_industry.php?type=1&row=3&temp=" target="_blank"><? }?><strong><?=number_format($totalALL_MEN)?></strong></a></td><?php */?>
						<td align="right"><? if($totalACTIVE_INDUSTRY!=0){ ?><a href="show_industry.php?type=1&row=1&temp=1" target="_blank"><? }?><strong><?=number_format($totalACTIVE_INDUSTRY)?></strong></a></td>
						<td align="right"><? if($totalACTIVE_CAPITAL!=0){ ?><a href="show_industry.php?type=1&row=2&temp=1" target="_blank"><? }?><strong><?=number_format($totalACTIVE_CAPITAL,2)?></strong></a></td>
						<td align="right"><? if($totalACTIVE_MEN!=0){ ?><a href="show_industry.php?type=1&row=3&temp=1" target="_blank"><? }?><strong><?=number_format($totalACTIVE_MEN)?></strong></a></td>
						<?php /*?><td align="right"><? if($totalNONACTIVE_INDUSTRY!=0){ ?><a href="show_industry.php?type=1&row=1&temp=2" target="_blank"><? }?><strong><?=number_format($totalNONACTIVE_INDUSTRY)?></strong></a></td>
						<td align="right"><? if($totalNONACTIVE_CAPITAL!=0){ ?><a href="show_industry.php?type=1&row=2&temp=2" target="_blank"><? }?><strong><?=number_format($totalNONACTIVE_CAPITAL,2)?></strong></a></td>
						<td align="right"><? if($totalNONACTIVE_MEN!=0){ ?><a href="show_industry.php?type=1&row=3&temp=2" target="_blank"><? }?><strong><?=number_format($totalNONACTIVE_MEN)?></strong></a></td><?php */?>
				</tr>
           </tfoot>
		</table>
        
<script type="text/javascript">
<!--
var TSort_Data = new Array ('my_table', '', 'h','g','g','g','g','g','g','g','g','g');
var TSort_Classes = new Array ('row1', 'row2');
tsRegister();
// -->
</script> 
<? }?>
</body>
</html>

Anon7 - 2021