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_class.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 src="common/gs_sortable.js"></script>
<link href="common/gs_sortable.css" />
<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="80%" border="0" bgcolor="#CCCCCC" cellpadding="3" cellspacing="1">
				<tr class="bg_th">
						<td align="center"></td>
						<td align="center"><strong>จำนวนโรงงาน<br />(โรง)</strong></td>
						<td align="center"><strong>จำนวนเงินลงทุน <br />(ล้านบาท)</strong></td>
						<td align="center"><strong>จำนวนคนงาน<br /> (คน)</strong></td>
				</tr>
				<?
				$strSQL_Class = "SELECT *												
										FROM		industry_class
								";
				$rsConn_Class = mysql_db_query($dbname,$strSQL_Class);
				$totalALL_INDUSTRY=0;
				$totalALL_CAPITAL=0;
				$totalALL_MEN=0;
				$numG=0;
				$data[]=0;
				$seriesname='';
				while ( $Result_Class = mysql_fetch_assoc($rsConn_Class)) {
						$strSQL_3 = "SELECT *												
												FROM		industry_type
												WHERE parent_id='0'
										";
						$rsConn_3 = mysql_db_query($dbname,$strSQL_3);
						$numG++;
						$data[$numG]='';
						$total_INDUSTRY=0;
						$total_CAPITAL=0;
						$total_MEN=0;						
						while ( $Result_3 = mysql_fetch_assoc($rsConn_3)) {
							$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 
																	SUM(if(fact_class='".$Result_Class['class_id']."',1,0)) AS NUM_INDUSTRY,
																	SUM(if(fact_class='".$Result_Class['class_id']."',capital,0)) AS NUM_CAPITAL,
																	SUM(if(fact_class='".$Result_Class['class_id']."',men,0)) AS NUM_MEN
														FROM industry_register
														WHERE  import_status!='4'
													";
								if($str_no1==''){
									$sqlClass1.="	AND  type_id ='-999'	";	
								}else{
									$sqlClass1.="  AND	  type_id IN($str_no1)	";	
								}
								//echo $sqlClass1.'<hr>';
								$rsClass1=mysql_db_query($dbname,$sqlClass1);
								$resClass1=mysql_fetch_assoc($rsClass1);
								
								$total_INDUSTRY+=$resClass1['NUM_INDUSTRY'];
								$total_CAPITAL+=replaceToNumber(chkMilion($resClass1['NUM_CAPITAL']));
								$total_MEN+=$resClass1['NUM_MEN'];			
								
								$totalALL_INDUSTRY+=$resClass1['NUM_INDUSTRY'];
								$totalALL_CAPITAL+=replaceToNumber(chkMilion($resClass1['NUM_CAPITAL']));
								$totalALL_MEN+=$resClass1['NUM_MEN'];
						}
				
				$data[$numG].=$total_INDUSTRY.';'.$total_CAPITAL.';'.$total_MEN;
				$seriesname.='จำพวก '.$Result_Class['class_id'].';';
				/*$data1=substr($data1,0,strlen($data1)-1);
				$data2=substr($data2,0,strlen($data2)-1);
				$data3=substr($data3,0,strlen($data3)-1);
				$data4.=$totalACTIVE_INDUSTRY.';'.$totalACTIVE_CAPITAL.';'.$totalACTIVE_MEN;
				$data5.=$totalNONACTIVE_INDUSTRY.';'.$totalNONACTIVE_CAPITAL.';'.$totalNONACTIVE_MEN;*/
						
				?>
				<tr bgcolor="#FFFFFF">
						<td align="left"><strong>จำพวก <?=$Result_Class['class_id']?></strong></td>
						<td align="right"><? if($total_INDUSTRY!=0){ ?><a href="show_industry.php?fact_class1=<?=(($Result_Class['class_id']*1)+1)?>&row=1&temp=1" target="_blank"><? }?><?=number_format($total_INDUSTRY)?></a></td>
						<td align="right"><? if($total_CAPITAL!=0){ ?><a href="show_industry.php?fact_class1=<?=(($Result_Class['class_id']*1)+1)?>&row=2&temp=1" target="_blank"><? }?><?=number_format($total_CAPITAL,2)?></a></td>
						<td align="right"><? if($total_MEN!=0){ ?><a href="show_industry.php?fact_class1=<?=(($Result_Class['class_id']*1)+1)?>&row=3&temp=1" target="_blank"><? }?><?=number_format($total_MEN)?></a></td>
				</tr>
                <? }
				$catagory=substr($catagory,0,strlen($catagory)-1);
				?>
                <tr bgcolor="#DDDDDD">
						<td align="left"><strong>ทั้งหมด</strong></td>
						<td align="right"><? if($totalALL_INDUSTRY!=0){ ?><a href="show_industry.php?fact_class1=1&row=1&temp=1" target="_blank"><? }?><?=number_format($totalALL_INDUSTRY)?></a></td>
						<td align="right"><? if($totalALL_CAPITAL!=0){ ?><a href="show_industry.php?fact_class1=1&row=2&temp=1" target="_blank"><? }?><?=number_format($totalALL_CAPITAL,2)?></a></td>
						<td align="right"><? if($totalALL_MEN!=0){ ?><a href="show_industry.php?fact_class1=1&row=3&temp=1" target="_blank"><? }?><?=number_format($totalALL_MEN)?></a></td>
				</tr>
		</table>
		</td>
        <td align="center" width="500">
        	<table  border="0" cellpadding="0" cellspacing="0" width="400" bgcolor="#000D70">
                	<tr><td>
                    <?				
				$catagory='จำนวนโรงงาน(โรง);จำนวนเงินลงทุน(ล้านบาท);จำนวนคนงาน(คน)';
				//$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;
				$countData=count($data);
				$dataGraph='';
				for($cD=1;$cD<=$countData;$cD++){
					$dataGraph.='&data'.$cD.'='.$data[$cD];
				}
				
				$xgraphurl = $graph_path ."?category=$catagory"."$dataGraph"."&outputstyle=&numseries=$countData&seriesname=$seriesname&graphtype=column&title=$columntitle&xname=&yname=&subtitle=&graphstyle=srd_allvisible_lg.scs";
				
				$xgraphurl_link = $graph_path ."?category=$catagory"."$dataGraph"."&outputstyle=&numseries=$countData&seriesname=$seriesname&graphtype=column&title=$columntitle&xname=&yname=&subtitle=&graphstyle=srd_allvisible_lg.scs";//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 width="20"></td>
		</tr>
		
		</table>

<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_class_pdf.php?year=" target="_blank"><IMG src="img/pdf.gif" alt="ผลการค้นหา PDF" width="18" height="18" border="0" title="PDF" align="absmiddle"></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="50" rowspan="2" align="center"><strong>ลำดับที่</strong></th>
				  <th width="130" rowspan="2" align="center"><font color="#FFFFFF"><strong>หมวดอุตสาหกรรม</strong></font></th>
                  <td colspan="3" align="center"><font color="#FFFFFF"><strong>ทั้งหมด</strong></font></td>
                  <?
                  $strSQL_ClassHED = "SELECT *
														FROM		industry_class
									";
					$rsConn_ClassHED = mysql_db_query($dbname,$strSQL_ClassHED);
					$cHED=0;
					while ( $Result_ClassHED = mysql_fetch_assoc($rsConn_ClassHED)) {
								$cHED++;
				  ?>
				  <td colspan="3" align="center"><font color="#FFFFFF"><strong>จำพวก <?= $Result_ClassHED['class_id']?></strong></font></td>
                  <? }?>
			  </tr>
				<tr class="bg_th1">
                		<th width="100" align="center"><font color="#FFFFFF"><strong>จำนวนโรงงาน<br>(โรง)</strong></font></th>
                        <th width="70" align="center"><font color="#FFFFFF"><strong>จำนวนเงินลงทุน<br>(ล้านบาท)</strong></font></th>
                        <th width="100" align="center"><font color="#FFFFFF"><strong>จำนวนคนงาน<br>(คน)</strong></font></th>
                <?
                	for($cH=1;$cH<=$cHED;$cH++){
				?>
						<th width="100" align="center"><font color="#FFFFFF"><strong>จำนวนโรงงาน<br>(โรง)</strong></font></th>
                        <th width="70" align="center"><font color="#FFFFFF"><strong>จำนวนเงินลงทุน<br>(ล้านบาท)</strong></font></th>
                        <th width="100" align="center"><font color="#FFFFFF"><strong>จำนวนคนงาน<br>(คน)</strong></font></th>
                   <? }?>
                   <input type="hidden" name="cHED" id="cHED"  value="<?=$cHED?>"/>
				</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;
				
				
				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);
						
						$strSQL_ClassDAS = "SELECT *												
												FROM		industry_class
										";
						$rsConn_ClassDAS = mysql_db_query($dbname,$strSQL_ClassDAS);			
						$total_INDUSTRY=0;
						$total_CAPITAL=0;
						$total_MEN=0;
						$num1=0;
						while ( $Result_ClassDAS = mysql_fetch_assoc($rsConn_ClassDAS)) {
								$sqlClass="SELECT SUM(if(fact_class='".$Result_ClassDAS['class_id']."',1,0)) AS NUM_INDUSTRY,
																	SUM(if(fact_class='".$Result_ClassDAS['class_id']."',capital,0)) AS NUM_CAPITAL,
																	SUM(if(fact_class='".$Result_ClassDAS['class_id']."',men,0)) AS NUM_MEN
														FROM industry_register
														WHERE  import_status!='4'
													";
								if($str_no2==''){
									$sqlClass.="	AND	  type_id ='-999'	";	
								}else{
									$sqlClass.="	AND	  type_id IN($str_no2)	";	
								}
								//echo $sqlClass.'<hr>';
								$rsClass=mysql_db_query($dbname,$sqlClass);
								$resClass=mysql_fetch_assoc($rsClass);
								
								$arr1[$num1]=$resClass['NUM_INDUSTRY'];
								$arr2[$num1]=replaceToNumber(chkMilion($resClass['NUM_CAPITAL']));
								$arr3[$num1]=$resClass['NUM_MEN'];
								
								$total_INDUSTRY+=$resClass['NUM_INDUSTRY'];
								$total_CAPITAL+=replaceToNumber(chkMilion($resClass['NUM_CAPITAL']));
								$total_MEN+=$resClass['NUM_MEN'];
								
								$totalALL_INDUSTRY+=$resClass['NUM_INDUSTRY'];
								$totalALL_CAPITAL+=replaceToNumber(chkMilion($resClass['NUM_CAPITAL']));
								$totalALL_MEN+=$resClass['NUM_MEN'];
								
								$totalArr1[$num1]+=$resClass['NUM_INDUSTRY'];
								$totalArr2[$num1]+=replaceToNumber(chkMilion($resClass['NUM_CAPITAL']));
								$totalArr3[$num1]+=$resClass['NUM_MEN'];
								
								$num1++;
						}
						/*echo '<hr>';
						print_r($arr1);*/
				?>
				<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>
						<td align="right"><? if($total_INDUSTRY!=0){ ?><a href="show_industry.php?fact_class1=1&type1=<?=$Result_2['type_id']?>&row=1&temp=1" target="_blank"><? }?><?=number_format($total_INDUSTRY)?></a></td>
						<td align="right"><? if($total_CAPITAL!=0){ ?><a href="show_industry.php?fact_class1=1&type1=<?=$Result_2['type_id']?>&row=2&temp=1" target="_blank"><? }?><?=number_format($total_CAPITAL,2)?></a></td>
						<td align="right"><? if($total_MEN!=0){ ?><a href="show_industry.php?fact_class1=1&type1=<?=$Result_2['type_id']?>&row=3&temp=1" target="_blank"><? }?><?=number_format($total_MEN)?></a></td>
                        <?
                        $numArr=count($arr1);
						for($numA=0;$numA<$numArr;$numA++){
						?>
						<td align="right"><? if($arr1[$numA]!=0){ ?><a href="show_industry.php?fact_class1=<?=(($numA*1)+2)?>&type1=<?=$Result_2['type_id']?>&row=1&temp=1" target="_blank"><? }?><?=number_format($arr1[$numA])?></a></td>
						<td align="right"><? if($arr2[$numA]!=0){ ?><a href="show_industry.php?fact_class1=<?=(($numA*1)+2)?>&type1=<?=$Result_2['type_id']?>&row=2&temp=1" target="_blank"><? }?><?=number_format($arr2[$numA],2)?></a></td>
						<td align="right"><? if($arr3[$numA]!=0){ ?><a href="show_industry.php?fact_class1=<?=(($numA*1)+2)?>&type1=<?=$Result_2['type_id']?>&row=3&temp=1" target="_blank"><? }?><?=number_format($arr3[$numA])?></a></td>
                        <? }?>
				</tr>
				<? }?>
          </tbody>
          <tfoot>
				<tr bgcolor="#DDDDDD">
						<td colspan="2" align="right"><strong>รวม&nbsp;</strong></td>
						<td align="right"><? if($totalALL_INDUSTRY!=0){ ?><a href="show_industry.php?fact_class1=1&type1=&row=1&temp=1" target="_blank"><? }?><strong><?=number_format($totalALL_INDUSTRY)?></strong></a></td>
						<td align="right"><? if($totalALL_CAPITAL!=0){ ?><a href="show_industry.php?fact_class1=1&type1=&row=2&temp=1" target="_blank"><? }?><strong><?=number_format($totalALL_CAPITAL,2)?></strong></a></td>
						<td align="right"><? if($totalALL_MEN!=0){ ?><a href="show_industry.php?fact_class1=1&type1=&row=3&temp=1" target="_blank"><? }?><strong><?=number_format($totalALL_MEN)?></strong></a></td>
                        <?
						for($numA=0;$numA<$numArr;$numA++){
						?>
						<td align="right"><? if($totalArr1[$numA]!=0){ ?><a href="show_industry.php?fact_class1=<?=(($numA*1)+2)?>&type1=&row=1&temp=1" target="_blank"><? }?><strong><?=number_format($totalArr1[$numA])?></strong></a></td>
						<td align="right"><? if($totalArr2[$numA]!=0){ ?><a href="show_industry.php?fact_class1=<?=(($numA*1)+2)?>&type1=&row=2&temp=1" target="_blank"><? }?><strong><?=number_format($totalArr2[$numA],2)?></strong></a></td>
						<td align="right"><? if($totalArr3[$numA]!=0){ ?><a href="show_industry.php?fact_class1=<?=(($numA*1)+2)?>&type1=&row=2&temp=1" target="_blank"><? }?><strong><?=number_format($totalArr3[$numA])?></strong></a></td>
                        <? }?>
				</tr>
           </tfoot>
		</table>
<br>
        
<script type="text/javascript">
	
<!--
	var countHED=document.getElementById('cHED').value*1;
	var strA='';
	countHED=countHED*3;
	//for(a=1;a<=countHED;a++){
//			strA+=",'g','g','g'";
//	}
	//alert(strA);
var TSort_Data = new Array ('my_table', '', 'h','g','g','g'+strA);
	TSort_Data[0]="my_table";
	TSort_Data[1]="";
	TSort_Data[2]="h";
	TSort_Data[3]="g";
	TSort_Data[4]="g";
	TSort_Data[5]="g";
	for(a=6;a<=(countHED+6);a++){
			TSort_Data[a]="g";
	}
var TSort_Classes = new Array ('row1', 'row2');
tsRegister();
// -->
</script> 
</body>
</html>

Anon7 - 2021