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/exsum.php_bk
<? //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");

/* ฟังก์ชั่นคำนวณร้อยละ Modified By : Aussy [2552-10-02 19:04] */
	function percentage ( $arrVal, $intDec=2, $intPercent=100 ) {
		if ( $arrVal && is_array($arrVal) ) {
			#shwArray($arrVal);

			$SumOfVal = array_sum($arrVal); #echo "Total of Value is : ".$SumOfVal."<br>";
			
			foreach ( $arrVal as $Key => $Val ) {
				$arrVal[$Key] = number_format((($Val * $intPercent) / $SumOfVal), $intDec + 1); // จำนวนร้อยละ ทศนิยม +1

				// ชุดตัวแปร Array ร้อยละ จำนวนหลักทศนิยม
				if ( substr($arrVal[$Key], -1, 1) < 5 ) { # A2
					$arrA2Ori[$Key] = $arrVal[$Key];
					$arrA2[$Key] = number_format($arrVal[$Key], $intDec);
					$Ref = explode(".", $arrA2[$Key]);
					$arrA2LastChar[$Key] = substr($arrA2Ori[$Key], -1, 1);
				} else { # A1
					$arrA1Ori[$Key] = $arrVal[$Key];
					$arrA1[$Key] = number_format($arrVal[$Key], $intDec);
					$Ref = explode(".", $arrA1[$Key]);
					$arrA1LastChar[$Key] = substr($arrA1Ori[$Key], -1, 1);
				}
				
				$arrVInt[$Key] = $Ref[0]; // ชุดตัวแปรจำนวนเต็ม (ตัดทศนิยมทิ้ง)
				$arrVDec[$Key] = $Ref[1]; // ชุดตัวแปรจำนวนทศนิยม
				
			}
			
			#shwArray($arrVal);
			
			$x0 = array_sum($arrVInt);			#echo "x0 = ".$x0."<br>";
			$x1 = $intPercent - $x0;				#echo "x1 = ".$x1."<br>";
			$x2 = ($x1 * pow(10, $intDec));	#echo "x2 = ".$x2."<br>";
			$x3 = array_sum($arrVDec);			#echo "x3 = ".$x3."<br>";
			$x4 = $x3 - $x2;							#echo "x4 = ".$x4."<br>";
			
			#shwArray($arrA1Ori);
			#shwArray($arrA2Ori);
			//echo (count($arrA1LastChar));
			
			if(count($arrA1LastChar) > 0)
			{
				arsort($arrA1LastChar);
			}

			if(count($arrA2LastChar) > 0)
			{
				arsort($arrA2LastChar);
			}
			#shwArray($arrA1LastChar);
			#shwArray($arrA2LastChar);
			
			#shwArray($arrA1);
			#shwArray($arrA2);
			if ( $x4 == 0 ) {
				
				if(is_array($arrA1))
				{
					foreach ( $arrA1 as $Key => $Val ) 
					{
						$arrResult[$Key] = $arrA1[$Key];
					}
				}
				if(is_array($arrA2))
				{
					foreach ( $arrA2 as $Key => $Val ) 
					{
						$arrResult[$Key] = $arrA2[$Key];
					}
				}
			} elseif ( $x4 > 0 ) {
				$intA = 1;
				foreach ( $arrA1LastChar as $Key => $Val ) {
					if ( $intA <= (count($arrA1Ori) - $x4) ) $arrResult[$Key] = $arrA1[$Key]; else $arrResult[$Key] = substr($arrA1Ori[$Key], 0, strlen($arrA1Ori[$Key]) - 1);
					$intA++;
				}
				
				foreach ( $arrA2 as $Key => $Val ) $arrResult[$Key] = $arrA2[$Key];
			} elseif ( $x4 < 0 ) {
				$intA = 1;
				foreach ( $arrA2LastChar as $Key => $Val ) {
					if ( $intA <= abs($x4) ) $arrResult[$Key] = $arrA2[$Key] + 1/(pow(10, $intDec)); else $arrResult[$Key] = $arrA2[$Key];
					$intA++;
				}
				
				foreach ( $arrA1 as $Key => $Val ) $arrResult[$Key] = $arrA1[$Key];
			}
			
			#shwArray($arrResult);
			#echo "Total of Percent is : ".number_format(array_sum($arrResult), 2)."<br>";
			
			return $arrResult;
		}
	}	

function dateFormat($value,$type){
			if($type=="engthai"){
			
				$day = explode("-",$value);
				$date = $day[2].'/'.$day[1].'/'.($day[0]+543);			
				if((int)$day[0]==0){
					$date='';
				}
			}else if($type=="thaieng"){
			
				$day = explode("/",$value);
				$date = ($day[2]-543).'-'.$day[1].'-'.$day[0];
				
			}else if($type=="thaidot"){
			
				$Month = array("", "ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค.");
				$day = explode("-",$value);
				$Y = $day[0];
				$m = $day[1];
				if($m<10){
					$m = str_replace("0","",$m);
				}
				$d = $day[2]*1;
				$date = $d.' '.$Month[$m].' '.($Y+543);
				
			}else if($type==""){
			
				$date = explode("-",$value);
				
			}
			
			return $date;
		}
?>
<!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;
}
A:visited {
	FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Tahoma,  "Microsoft Sans Serif"; TEXT-DECORATION: underline;FONT-WEIGHT: bold;
}
A:active {
	FONT-SIZE: 12px; COLOR: #014d5f; FONT-FAMILY: Tahoma,  "Microsoft Sans Serif"; TEXT-DECORATION: underline;FONT-WEIGHT: bold;
}
A:hover {
	FONT-SIZE: 12px; COLOR: #f3960b; FONT-FAMILY: Tahoma,  "Microsoft Sans Serif"; TEXT-DECORATION: underline;FONT-WEIGHT: bold;
}
.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;
  }
  .bg_th1{
  background-repeat:repeat-x;
  background-color:#305086;
  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"); 
?>
		<table width="75%" border="0" align="center" cellpadding="3" cellspacing="1">
		<tr><td><strong>กระดานแสดงจำนวนโรงงานอุตสาหกรรม ข้อมูล ณ วันที่ <?=dateFormat(date('Y-m-d'),'thaidot')?></strong></td></tr>
		</table>
		
		<table width="75%" border="0" align="center" cellpadding="0" cellspacing="4">
		<tr><td valign="top">
		<table width="100%" border="0" align="center" bgcolor="#CCCCCC" cellpadding="3" cellspacing="1">
				<tr class="bg_th">
						<td><strong>ประเภทการดำเนินการงาน</strong></td>
						<td width="120"><strong>จำนวนโรงงาน</strong></td>
						<td width="120"><strong>ร้อยละ</strong></td>
				</tr>
				<?
					$strSQL_1_1 = "SELECT 
												SUM(if(tempstop='0',1,0)) AS ACTIVE_INDUSTRY,
												SUM(if(tempstop='1',1,0)) AS NONACTIVE_INDUSTRY
										FROM industry_register
												";						
						$rsConn_1_1 = mysql_db_query($dbname,$strSQL_1_1);
						$Result_1_1 = mysql_fetch_assoc($rsConn_1_1);
						$total=$Result_1_1['ACTIVE_INDUSTRY']+$Result_1_1['NONACTIVE_INDUSTRY'];
						if($total==0){
							$acIn=0;
							$nonIn=0;
							$percenAll=0;						
						}else{
							$acIn=($Result_1_1['ACTIVE_INDUSTRY']*100)/$total;
							$nonIn=($Result_1_1['NONACTIVE_INDUSTRY']*100)/$total;
							/*$arr=array($acIn,$nonIn);
							$percen = percentage($arr);*/
							$percenAll=($total*100)/$total;
						}
				?>
				<tr bgcolor="#FFFFFF">
						<td align="left"><strong>ยังดำเนินการอยู่</strong></td>
						<td align="center"><?=number_format($Result_1_1['ACTIVE_INDUSTRY'])?></td>
						<td align="center"><?=number_format($acIn,2)?></td>
				</tr>
				<tr bgcolor="#FFFFFF">
						<td><strong>เลิกกิจการ</strong></td>
						<td align="center"><?=number_format($Result_1_1['NONACTIVE_INDUSTRY'])?></td>
						<td align="center"><?=number_format($nonIn,2)?></td>
				</tr>
				<tr bgcolor="#EEEEEE">
						<td><strong>ทั้งหมด</strong></td>
						<td align="center"><?=number_format($total)?></td>
						<td align="center"><?=number_format($percenAll,2)?></td>
				</tr>
				
		</table>
		</td>
			<td valign="top"  align="center"bgcolor="#000D70" width="400">
			<?
			$data1="";
			$data1=number_format($acIn,2).';'.number_format($nonIn,2);
			//echo $data1;
			$catagory="ยังดำเนินการอยู่;เลิกกิจการ";
		//$data1=substr($data1,0,strlen($data1)-1);
		//$catagory=substr($catagory,0,strlen($catagory)-1);
		//echo $catagory;
		$graph_path = "http://202.129.35.106/graphservice/graphservice.php";  //Sapphire Graph
		//$catagory = 'ระดับความรุนแรงน้อย;ระดับความรุนแรงปานกลาง;ระดับความรุนแรงมาก';
		/*$w1=375;
		$h1=188;*/
		$w1=400;
		$h1=200;
		
		$columntitle="กราฟแสดงจำนวนโรงงานอุตสาหกรรมจำแนกตามสถานะการดำเนินการกิจการ ";
			$xgraphurl = $graph_path ."?category=$catagory"."&data1="."$data1"."&outputstyle=&numseries=1&seriesname=&graphtype=pie&title=$columntitle&xname=&yname=&subtitle=&graphstyle=epm_sf_003";
			//echo $xgraphurl;
			$xgraphurl_link = $graph_path ."?category=$catagory"."&data1="."$data1"."&outputstyle=&numseries=1&seriesname=&graphtype=pie&title=$columntitle&xname=&yname=&subtitle=&graphstyle=epm_sf_003&xcontrol=1";//srd_sf_004
		?>
		<table width="400" 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>
</body>
</html>

Anon7 - 2021