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_compair_industry.php
<? session_start() ; 
if($_GET['status']!='executive'){
header("Content-Type: text/html; charset=windows-874"); 
}
set_time_limit(0) ; 

include_once("../../config/config_epm.inc.php");
if($_GET['status']=='executive'){
		include_once("../industry/manage_user.inc.php");
		include_once("../industry/function/function.inc.php");
		$graph_path = "http://202.129.35.106/graphservice/graphservice.php";
}else{
		include_once("manage_user.inc.php");
		include_once("function/function.inc.php");
}

$strGET='';
if($_GET['p']){
		$strGET.='&p='.$_GET['p'];
}
if($_GET['path']){
		$strGET.='&path='.$_GET['path'];
}
if($_GET['status']){
		$strGET.='&status='.$_GET['status'];
}
?>
<!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>
<?
if($_GET['status']!='executive'){
?>
<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>
<? 
if($_GET['status']!='executive'){
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>
        		<?
                if($_GET['status']!='executive'){
				?>
                <td align="center"><strong style="color:#000033; font-size:16px;">รายงานข้อมูลลักษณะการประกอบอุตสาหกรรมโดยทั่วไปภายในจังหวัด</strong></td>
                <?
				}else{
				?>
                <td align="center"><span class="header16">รายงานข้อมูลลักษณะการประกอบอุตสาหกรรมโดยทั่วไปภายในจังหวัด</span></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 import_status!='4'
											";
						$rsCompair1=mysql_db_query($dbname,$sqlCompair1);
						$resCompair1=mysql_fetch_assoc($rsCompair1);
						
						$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 import_status!='4'
											";
						$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="../industry/img/delta_up.png" width="14" height="14" align="top" />';
						}else if($resCompair1['ALL_INDUSTRY']>$resCompair2['ALL_INDUSTRY']){
								$imgIndustry='<img src="../industry/img/delta_down.png" width="14" height="14" align="top" />';
						}else{
								$imgIndustry='<img src="../industry/img/equal_symbol.png" width="14" height="14" align="top" />';
						}
						
						if($resCompair1['ALL_CAPITAL']<$resCompair2['ALL_CAPITAL']){
								$imgCapital='<img src="../industry/img/delta_up.png" width="14" height="14" align="top" />';
						}else if($resCompair1['ALL_CAPITAL']>$resCompair2['ALL_CAPITAL']){
								$imgCapital='<img src="../industry/img/delta_down.png" width="14" height="14" align="top" />';
						}else{
								$imgCapital='<img src="../industry/img/equal_symbol.png" width="14" height="14" align="top" />';
						}
						
						if($resCompair1['ALL_MEN']<$resCompair2['ALL_MEN']){
								$imgMen='<img src="../industry/img/delta_up.png" width="14" height="14" align="top" />';
						}else if($resCompair1['ALL_MEN']>$resCompair2['ALL_MEN']){
								$imgMen='<img src="../industry/img/delta_down.png" width="14" height="14" align="top" />';
						}else{
								$imgMen='<img src="../industry/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="27%">
                		</td>
						<td width="20%" align="left"></td>
						<td width="53%" align="right"><a href="?year_start=<?=$_GET['year_start']?>&year_end=<?=$_GET['year_end']?><?=$strGET?>&compair=<?=($_GET['compair']=='')?'1':''?>"><?=($_GET['compair']=='')?'[รายงานเปรียบเทียบ]':'[รายงานแบบปกติ]'?></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="3" align="center"><strong>ลำดับที่</strong></th>
				  <th width="130" rowspan="3" align="center"><font color="#FFFFFF"><strong>หมวดอุตสาหกรรม</strong></font></th>
				  <td colspan="6">
                  		<div><span  style=" float:left"><a href="?year_start=<?=($year_start-1)?>&year_end=<?=$year_end?><?=$strGET?>&compair=<?=$_GET['compair']?>"><img src="../industry/img/back.jpg" border="0" width="20" height="20" align="absmiddle" /></a></span>
                        <span style="float:center"><font color="#FFFFFF"><strong>ปี พ.ศ. <?=$year_start?></strong></font></span>
                        <span style="float:right"><a href="?year_start=<?=($year_start+1)?>&year_end=<?=$year_end?><?=$strGET?>&compair=<?=$_GET['compair']?>"><?=($year_start==(date('Y')+543) || $year_end==$year_start)?'':'<img src="../industry/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="6">
                  		<div><span  style=" float:left"><a href="?year_start=<?=$year_start?>&year_end=<?=($year_end-1)?><?=$strGET?>&compair=<?=$_GET['compair']?>"><?=($year_end==$year_start)?'':'<img src="../industry/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)?><?=$strGET?>&compair=<?=$_GET['compair']?>"><?=($year_end==(date('Y')+543))?'':'<img src="../industry/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_th<?=($_GET['status']!='executive')?'1':''?>">
				  <th width="90" rowspan="2" align="center"><font color="#FFFFFF"><strong>จำนวนโรงงาน<br>(โรง)</strong></font></th>
				  <th width="90" rowspan="2" align="center"><font color="#FFFFFF"><strong>จำนวนเงินลงทุน<br>(ล้านบาท)</strong></font></th>
				  <td colspan="3" align="center"><font color="#FFFFFF"><strong>จำนวนคนงาน (คน)</strong></font></td>
				  <th width="90" rowspan="2" align="center"><font color="#FFFFFF"><strong>กำลังผลิต (แรงม้า)</strong></font></th>
                  <?
					if($_GET['compair']){
					?>
				  <th width="90" rowspan="2" align="center"><font color="#FFFFFF"><strong>จำนวนโรงงาน<br>(โรง)</strong></font></th>
				  <th width="90" rowspan="2" align="center"><font color="#FFFFFF"><strong>จำนวนเงินลงทุน<br>(ล้านบาท)</strong></font></th>
				  <td colspan="3" align="center"><font color="#FFFFFF"><strong>จำนวนคนงาน (คน)</strong></font></td>
				  <th width="90" rowspan="2" align="center"><font color="#FFFFFF"><strong>กำลังผลิต (แรงม้า)</strong></font></th>
                  <? }?>
			  </tr>
				<tr class="bg_th<?=($_GET['status']!='executive')?'1':''?>">
						<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>
                        <?
                        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>
                        <? }?>
                </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_1=0;
				$totalALL_CAPITAL_1=0;
				$totalALL_MAN_1=0;
				$totalALL_WOMEN_1=0;
				$totalALL_MEN_1=0;
				$totalALL_HP_1=0;
				
				$totalALL_INDUSTRY_2=0;
				$totalALL_CAPITAL_2=0;
				$totalALL_MAN_2=0;
				$totalALL_WOMEN_2=0;
				$totalALL_MEN_2=0;
				$totalALL_HP_2=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);
						$sqlTable_1="SELECT COUNT(code) AS ALL_INDUSTRY,
															SUM(capital) AS ALL_CAPITAL,
															SUM(man) AS ALL_MAN,
															SUM(women) AS ALL_WOMEN,
															SUM(men) AS ALL_MEN,
															SUM(hp) AS ALL_HP
												FROM industry_register
												WHERE  fyear='".$year_start."'  AND import_status!='4'
											";
						if($str_no2==''){
							$sqlTable_1.="	 and  type_id ='-999'	";	
						}else{
							$sqlTable_1.="	 and  type_id IN($str_no2)	";	
						}
						//echo $sqlTable_1.'<hr>';
						$rsTable_1=mysql_db_query($dbname,$sqlTable_1);
						$resTable_1=mysql_fetch_assoc($rsTable_1);
						
						$resTable_1['ALL_CAPITAL']=replaceToNumber(chkMilion($resTable_1['ALL_CAPITAL']));
						$totalALL_INDUSTRY_1+=$resTable_1['ALL_INDUSTRY'];
						$totalALL_CAPITAL_1+=$resTable_1['ALL_CAPITAL'];
						$totalALL_MAN_1+=$resTable_1['ALL_MAN'];
						$totalALL_WOMEN_1+=$resTable_1['ALL_WOMEN'];
						$totalALL_MEN_1+=$resTable_1['ALL_MEN'];
						$totalALL_HP_1+=$resTable_1['ALL_HP'];
						
				?>
				<tr bgcolor="#FFFFFF">
						<td align="center"><?=$rowNumb?></td>
						<td align="left"><?=$Result_2['type_name']?></td>
						<td align="right"><?=number_format($resTable_1['ALL_INDUSTRY'])?></td>
						<td align="right"><?=number_format($resTable_1['ALL_CAPITAL'],2)?></td>
						<td align="right"><?=number_format($resTable_1['ALL_MAN'])?></td>
						<td align="right"><?=number_format($resTable_1['ALL_WOMEN'])?></td>
						<td align="right"><?=number_format($resTable_1['ALL_MEN'])?></td>
						<td align="right"><?=number_format($resTable_1['ALL_HP'],2)?></td>
                        <?
						if($_GET['compair']){
								$sqlTable_2="SELECT COUNT(code) AS ALL_INDUSTRY,
																	SUM(capital) AS ALL_CAPITAL,
																	SUM(man) AS ALL_MAN,
																	SUM(women) AS ALL_WOMEN,
																	SUM(men) AS ALL_MEN,
																	SUM(hp) AS ALL_HP
														FROM industry_register
														WHERE  fyear='".$year_end."'  AND import_status!='4'
													";
								if($str_no2==''){
									$sqlTable_2.="	 and  type_id ='-999'	";	
								}else{
									$sqlTable_2.="	 and  type_id IN($str_no2)	";	
								}
								//echo $sqlClass.'<hr>';
								$rsTable_2=mysql_db_query($dbname,$sqlTable_2);
								$resTable_2=mysql_fetch_assoc($rsTable_2);
								
								$resTable_2['ALL_CAPITAL']=replaceToNumber(chkMilion($resTable_2['ALL_CAPITAL']));
								$totalALL_INDUSTRY_2+=$resTable_2['ALL_INDUSTRY'];
								$totalALL_CAPITAL_2+=$resTable_2['ALL_CAPITAL'];
								$totalALL_MAN_2+=$resTable_2['ALL_MAN'];
								$totalALL_WOMEN_2+=$resTable_2['ALL_WOMEN'];
								$totalALL_MEN_2+=$resTable_2['ALL_MEN'];
								$totalALL_HP_2+=$resTable_2['ALL_HP'];
						?>
						<td align="center"><?=number_format($resTable_2['ALL_INDUSTRY'])?></td>
						<td align="right"><?=number_format($resTable_2['ALL_CAPITAL'],2)?></td>
						<td align="right"><?=number_format($resTable_2['ALL_MAN'])?></td>
						<td align="right"><?=number_format($resTable_2['ALL_WOMEN'])?></td>
						<td align="right"><?=number_format($resTable_2['ALL_MEN'])?></td>
						<td align="right"><?=number_format($resTable_2['ALL_HP'],2)?></td>
                        <? }?>
				</tr>
				<? }?>
          </tbody>
          <tfoot>
				<tr bgcolor="#DDDDDD">
						<td colspan="2" align="right"><strong>รวม&nbsp;</strong></td>
						<td align="right"><strong><?=number_format($totalALL_INDUSTRY_1)?></strong></td>
						<td align="right"><strong><?=number_format($totalALL_CAPITAL_1,2)?></strong></td>
						<td align="right"><strong><?=number_format($totalALL_MAN_1)?></strong></td>
						<td align="right"><strong><?=number_format($totalALL_WOMEN_1)?></strong></td>
						<td align="right"><strong><?=number_format($totalALL_MEN_1)?></strong></td>
						<td align="right"><strong><?=number_format($totalALL_HP_1,2)?></strong></td>
                        <?
						if($_GET['compair']){
						?>
						<td align="center"><strong><?=number_format($totalALL_INDUSTRY_2)?></strong></td>
						<td align="right"><strong><?=number_format($totalALL_CAPITAL_2,2)?></strong></td>
						<td align="right"><strong><?=number_format($totalALL_MAN_2)?></strong></td>
						<td align="right"><strong><?=number_format($totalALL_WOMEN_2)?></strong></td>
						<td align="right"><strong><?=number_format($totalALL_MEN_2)?></strong></td>
						<td align="right"><strong><?=number_format($totalALL_HP_2,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>

Anon7 - 2021