|
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) ;
//print_r($_SESSION);
include_once("../../config/config_epm.inc.php");
include_once("manage_user.inc.php");
include_once("function/function.inc.php");
//include("common/create_temp.class.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" />
<link rel="stylesheet" href="css/template.css" type="text/css" />
<link rel="stylesheet" href="css/style.css" type="text/css" />
<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:#375c95;
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['pdf']==''){
//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;">แสดงข้อมูลโรงงานอุตสาหกรรม
<?
#การแสดงผลข้อมูลโรงงานอุตสาหกรรม จากไฟล์ report_fact_class.php รายงานข้อมูลโรงงานอุตสาหกรรมจำแนกตามจำพวก
if($_GET['fact_class']){
echo 'จำแนกตามจำพวก ';
if($_GET['fact_class']!='1'){
echo (($_GET['fact_class']*1)-1);
}
}
#การแสดงผลข้อมูลโรงงานอุตสาหกรรม จากไฟล์ report_capital.php รายงานข้อมูลโรงงานอุตสาหกรรมจำแนกตามขนาดการลงทุน
if($_GET['capital']){
echo 'จำแนกตามขนาดการลงทุน ';
if($_GET['capital']!='1'){
if($_GET['capital']=='2'){
echo ' [เงินทุน < 10 ล้านบาท] ';
}else if($_GET['capital']=='3'){
echo ' [เงินทุน 10-100 ล้านบาท] ';
}else if($_GET['capital']=='4'){
echo ' [เงินทุน > 100 ล้านบาท] ';
}
}
}
#การแสดงผลข้อมูลโรงงานอุตสาหกรรม จากไฟล์ report_industry.php รายงานข้อมูลโรงงานอุตสาหกรรมจำแนกตามหมวดอุตสาหกรรม
if($_GET['type']){
echo 'จำแนกตามหมวดอุตสาหกรรม ';
if($_GET['type']!='1'){
$strshow = "SELECT *
FROM industry_type
WHERE type_id='".$_GET['type']."'
";
$rsshow=mysql_db_query($dbname,$strshow);
$resshow=mysql_fetch_assoc($rsshow);
echo '['.$resshow['type_name'].']';
}
}
#การแสดงผลข้อมูลโรงงานอุตสาหกรรม จากไฟล์ report_industry_class.php รายงานข้อมูลโรงงานอุตสาหกรรมจำแนกหมวดอุตสาหกรรม และจำพวกอุตสาหกรรม(หมุนมิติ)
if($_GET['type1']){
echo 'จำแนกตาม';
if($_GET['type1']!='1'){
$strshow = "SELECT *
FROM industry_type
WHERE type_id='".$_GET['type1']."'
";
$rsshow=mysql_db_query($dbname,$strshow);
$resshow=mysql_fetch_assoc($rsshow);
echo $resshow['type_name'];
}
}
if($_GET['fact_class1']){
if($_GET['fact_class1']!='1'){
if($_GET['type1']){
if($_GET['type1']!='1'){
echo ' และ';
}
}
echo 'จำแนกตามจำพวก ';
echo (($_GET['fact_class1']*1)-1);
}
}
#การแสดงผลข้อมูลโรงงานอุตสาหกรรม จากไฟล์ report_industry_expansion.php รายงานอัตราการขยายตัวอุตสาหกรรม
if($_GET['type2']){
echo 'จำแนกตาม';
if($_GET['type2']!='1'){
$strshow = "SELECT *
FROM industry_type
WHERE type_id='".$_GET['type2']."'
";
$rsshow=mysql_db_query($dbname,$strshow);
$resshow=mysql_fetch_assoc($rsshow);
echo $resshow['type_name'];
}
}
if($_GET['year']){
echo ' ปี พ.ศ.'.$_GET['year'];
}
if($_GET['temp']){
echo " (สถานะ";
if($_GET['temp']=='1'){
echo 'ยังดำเนินการอยู่)';
}else if($_GET['temp']=='2'){
echo 'เลิกกิจการ)';
}
}
?>
</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>
<?
#การแสดงผลข้อมูลโรงงานอุตสาหกรรม จากไฟล์ report_fact_class.php รายงานข้อมูลโรงงานอุตสาหกรรมจำแนกตามจำพวก
if($_GET['fact_class']){
$strSQL_3 = "SELECT *
FROM industry_class
";
$rsConn_3 = mysql_db_query($dbname,$strSQL_3);
$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_3 = mysql_fetch_assoc($rsConn_3)) {
$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 fact_class='".$Result_3['class_id']."'
";
if($_GET['fact_class']){
if($_GET['fact_class']!='1'){
$sqlClass1.=" and fact_class ='".(($_GET['fact_class']*1)-1)."' ";
}
}
if($_GET['temp']=='1'){
$sqlClass1.=" and import_status!='4' ";
}else if($_GET['temp']=='2'){
$sqlClass1.=" and import_status='4' ";
}
$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'];
}
}
#การแสดงผลข้อมูลโรงงานอุตสาหกรรม จากไฟล์ report_capital.php รายงานข้อมูลโรงงานอุตสาหกรรมจำแนกตามขนาดการลงทุน
if($_GET['capital']){
$rows[1]= array(id=>"1",caption=>"ขนาดเล็ก<br>(เงินทุน < 10 บาท)",value=>'10');
$rows[2]= array(id=>"2",caption=>"ขนาดกลาง<br>(เงินทุน 10-100 บาท)",value=>'100');
$rows[3]= array(id=>"3",caption=>"ขนาดใหญ่<br>(เงินทุน > 100 บาท)",value=>'1000');
$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;
if($_GET['capital']){
if($_GET['capital']!='1'){
$start=($_GET['capital']*1)-1;
$end=($_GET['capital']*1)-1;
}else{
$start=1;
$end=3;
}
}else{
$start=1;
$end=3;
}
for($a=$start;$a<=$end;$a++){
//while ( $Result_2 = mysql_fetch_assoc($rsConn_2)) {
$i++;
$rowNumb = ($i+($board_link_num*$page)-$board_link_num);
$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
";
if($a==1){
$sqlClass1.=" WHERE (capital<10000000 OR capital IS NULL) ";
}else if($a==2){
$sqlClass1.=" WHERE (capital>=10000000 and capital<=100000000 ) ";
}else if($a==3){
$sqlClass1.=" WHERE capital>100000000 ";
}
if($_GET['temp']=='1'){
$sqlClass1.=" and import_status!='4' ";
}else if($_GET['temp']=='2'){
$sqlClass1.=" and import_status='4' ";
}
$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'];
}
}
#การแสดงผลข้อมูลโรงงานอุตสาหกรรม จากไฟล์ report_industry.php รายงานข้อมูลโรงงานอุตสาหกรรมจำแนกตามหมวดอุตสาหกรรม
if($_GET['type']){
$strSQL_3 = "SELECT *
FROM industry_type
WHERE
";
if($_GET['type']!='1'){
$strSQL_3.=" type_id='".$_GET['type']."' ";
}else{
$strSQL_3.=" parent_id='0' ";
}
$rsConn_3 = mysql_db_query($dbname,$strSQL_3);
$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) ";
}
if($_GET['temp']=='1'){
$sqlClass1.=" and import_status!='4' ";
}else if($_GET['temp']=='2'){
$sqlClass1.=" and import_status='4' ";
}
//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'];
}
}
#การแสดงผลข้อมูลโรงงานอุตสาหกรรม จากไฟล์ report_industry_class.php รายงานข้อมูลโรงงานอุตสาหกรรมจำแนกหมวดอุตสาหกรรม และจำพวกอุตสาหกรรม(หมุนมิติ)
if($_GET['fact_class1']){
$strSQL_3 = "SELECT *
FROM industry_class
";
$rsConn_3 = mysql_db_query($dbname,$strSQL_3);
$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_3 = mysql_fetch_assoc($rsConn_3)) {
$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 fact_class='".$Result_3['class_id']."'
";
if($_GET['fact_class1']){
if($_GET['fact_class1']!='1'){
$sqlClass1.=" and fact_class ='".(($_GET['fact_class1']*1)-1)."' ";
}
}
if($_GET['type1']){
$strSQL_2_1 = "SELECT *
FROM industry_type
WHERE type_id='".$_GET['type1']."'
";
$rsConn_2_1 = mysql_db_query($dbname,$strSQL_2_1);
$Result_2_1 = mysql_fetch_assoc($rsConn_2_1);
$strSQL_3_2_1 = "SELECT *
FROM industry_type
WHERE parent_id='".$Result_2_1['runid']."'
";
$rsConn_3_2_1 = mysql_db_query($dbname,$strSQL_3_2_1);
$str_no2='';
while ( $Result_3_2_1 = mysql_fetch_assoc($rsConn_3_2_1)) {
$str_no2.="'".$Result_3_2_1['type_id']."'".',';
}
$str_no2=substr($str_no2,0,strlen($str_no2)-1);
if($str_no2==''){
$sqlClass1.=" and type_id ='-999' ";
}else{
$sqlClass1.=" and type_id IN($str_no2) ";
}
}
if($_GET['temp']=='1'){
$sqlClass1.=" and import_status!='4' ";
}else if($_GET['temp']=='2'){
$sqlClass1.=" and import_status='4' ";
}
$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'];
}
}
#การแสดงผลข้อมูลโรงงานอุตสาหกรรม จากไฟล์ report_industry_expansion.php รายงานอัตราการขยายตัวอุตสาหกรรม
if($_GET['year']){
$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;
$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 code is not null
";
if($_GET['year']){
if($_GET['row']=='1'){
$sqlClass1.=" and fyear<='".$_GET['year']."' ";
}else{
$sqlClass1.=" and fyear='".$_GET['year']."' ";
}
//$sqlClass1.=" fyear='".$_GET['year']."' ";
}
if($_GET['fact_class']){
if($_GET['fact_class']!='1'){
$sqlClass1.=" and fact_class ='".(($_GET['fact_class']*1)-1)."' ";
}
}
if($_GET['capital']){
if($_GET['capital']!='1'){
$start=($_GET['capital']*1)-1;
if($start==1){
$sqlClass1.=" AND (capital<10000000 OR capital IS NULL) ";
}else if($start==2){
$sqlClass1.=" AND (capital>=10000000 and capital<=100000000 ) ";
}else if($start==3){
$sqlClass1.=" AND (capital>100000000 ) ";
}
}
}
if($_GET['type2']){
$strSQL_2_1 = "SELECT *
FROM industry_type
WHERE type_id='".$_GET['type2']."'
";
$rsConn_2_1 = mysql_db_query($dbname,$strSQL_2_1);
$Result_2_1 = mysql_fetch_assoc($rsConn_2_1);
$strSQL_3_2_1 = "SELECT *
FROM industry_type
WHERE parent_id='".$Result_2_1['runid']."'
";
$rsConn_3_2_1 = mysql_db_query($dbname,$strSQL_3_2_1);
$str_no2='';
while ( $Result_3_2_1 = mysql_fetch_assoc($rsConn_3_2_1)) {
$str_no2.="'".$Result_3_2_1['type_id']."'".',';
}
$str_no2=substr($str_no2,0,strlen($str_no2)-1);
if(substr($_GET['type2'],0,1)=='C'){
if($str_no2==''){
$sqlClass1.=" and type_id ='-999' ";
}else{
$sqlClass1.=" and type_id IN($str_no2) ";
}
}else{
$sqlClass1.=" and type_id ='".$_GET['type2']."' ";
}
}
$sqlClass1.=" and import_status!='4' ";
$rsClass1=mysql_db_query($dbname,$sqlClass1);
$resClass1=mysql_fetch_assoc($rsClass1);
$totalALL_INDUSTRY+=$resClass1['ALL_INDUSTRY'];
$totalALL_CAPITAL+=replaceToNumber(chkMilion($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+=replaceToNumber(chkMilion($resClass1['NONACTIVE_CAPITAL']));
$totalNONACTIVE_MEN+=$resClass1['NONACTIVE_MEN'];
}
?>
<tr bgcolor="#FFFFFF">
<td align="left"><strong>โรงงานในจังหวัดปทุมธานี</strong></td>
<td align="right"><?=number_format($totalACTIVE_INDUSTRY)?></td>
<td align="right"><?=number_format($totalACTIVE_CAPITAL,2)?></td>
<td align="right"><?=number_format($totalACTIVE_MEN)?></td>
</tr>
<?
if($temp!='1'){
?>
<?php /*?><tr bgcolor="#FFFFFF">
<td align="left"><strong>เลิกกิจการ</strong></td>
<td align="right"><?=number_format($totalNONACTIVE_INDUSTRY)?></td>
<td align="right"><?=number_format($totalNONACTIVE_CAPITAL,2)?></td>
<td align="right"><?=number_format($totalNONACTIVE_MEN)?></td>
</tr>
<tr bgcolor="#DDDDDD">
<td align="left"><strong>ทั้งหมด</strong></td>
<td align="right"><?=number_format($totalALL_INDUSTRY)?></td>
<td align="right"><?=number_format($totalALL_CAPITAL,2)?></td>
<td align="right"><?=number_format($totalALL_MEN)?></td>
</tr><?php */?>
<? }?>
</table>
</td>
<td width="20"></td>
</tr>
</table>
<br />
<script src="common/gs_sortable.js"></script>
<link href="common/gs_sortable.css" />
<?
$strSearch="";
$strSQL_1 = "SELECT
industry_register.type_id,
industry_register.prename,
industry_register.aname,
industry_register.lname,
industry_register.officeadd1,
industry_register.office_tam,
industry_register.office_amp,
industry_register.office_wat,
industry_register.office_zip,
industry_register.office_tel,
industry_register.location,
industry_register.tambol,
industry_register.ampur,
industry_register.telephone,
industry_register.code,
industry_register.update_time,
industry_register.men,
industry_register.women,
industry_register.man,
industry_register.capital
FROM industry_register
WHERE industry_register.code IS NOT NULL
";
#การแสดงผลข้อมูลโรงงานอุตสาหกรรม จากไฟล์ report_fact_class.php รายงานข้อมูลโรงงานอุตสาหกรรมจำแนกตามจำพวก
if($_GET['fact_class']){
if($_GET['fact_class']!='1'){
$strSQL_1.=" and fact_class ='".(($_GET['fact_class']*1)-1)."' ";
}
$strSearch.="&fact_class=".$_GET['fact_class'];
}
#การแสดงผลข้อมูลโรงงานอุตสาหกรรม จากไฟล์ report_capital.php รายงานข้อมูลโรงงานอุตสาหกรรมจำแนกตามขนาดการลงทุน
if($_GET['capital']){
if($_GET['capital']!='1'){
if($_GET['capital']=='2'){
$strSQL_1.=" and (capital<10000000 OR capital IS NULL) ";
}else if($_GET['capital']=='3'){
$strSQL_1.=" and (capital>=10000000 and capital<=100000000) ";
}else if($_GET['capital']=='4'){
$strSQL_1.=" and capital>100000000 ";
}
}
$strSearch.="&capital=".$_GET['capital'];
}
#การแสดงผลข้อมูลโรงงานอุตสาหกรรม จากไฟล์ report_industry.php รายงานข้อมูลโรงงานอุตสาหกรรมจำแนกตามหมวดอุตสาหกรรม
if($_GET['type']){
if($_GET['type']!='1'){
$strSQL_2 = "SELECT *
FROM industry_type
WHERE type_id='".$_GET['type']."'
";
$rsConn_2 = mysql_db_query($dbname,$strSQL_2);
$Result_2 = mysql_fetch_assoc($rsConn_2);
$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);
if($str_no2==''){
$strSQL_1.=" and type_id ='-999' ";
}else{
$strSQL_1.=" and type_id IN($str_no2) ";
}
}
$strSearch.="&type=".$_GET['type'];
}
#การแสดงผลข้อมูลโรงงานอุตสาหกรรม จากไฟล์ report_industry_class.php รายงานข้อมูลโรงงานอุตสาหกรรมจำแนกหมวดอุตสาหกรรม และจำพวกอุตสาหกรรม(หมุนมิติ)
if($_GET['fact_class1']){
if($_GET['fact_class1']!='1'){
$strSQL_1.=" and fact_class ='".(($_GET['fact_class1']*1)-1)."' ";
}
if($_GET['type1']){
$strSQL_2 = "SELECT *
FROM industry_type
WHERE type_id='".$_GET['type1']."'
";
$rsConn_2 = mysql_db_query($dbname,$strSQL_2);
$Result_2 = mysql_fetch_assoc($rsConn_2);
$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);
if($str_no2==''){
$strSQL_1.=" and type_id ='-999' ";
}else{
$strSQL_1.=" and type_id IN($str_no2) ";
}
}
$strSearch.="&fact_class1=".$_GET['fact_class1'];
$strSearch.="&type1=".$_GET['type1'];
}
#การแสดงผลข้อมูลโรงงานอุตสาหกรรม จากไฟล์ report_industry_expansion.php รายงานอัตราการขยายตัวอุตสาหกรรม
if($_GET['year']){
if($_GET['row']=='1'){
$strSQL_1.=" and fyear <='".$_GET['year']."' ";
}else{
$strSQL_1.=" and fyear ='".$_GET['year']."' ";
}
if($_GET['type2']){
$strSQL_2 = "SELECT *
FROM industry_type
WHERE type_id='".$_GET['type2']."'
";
$rsConn_2 = mysql_db_query($dbname,$strSQL_2);
$Result_2 = mysql_fetch_assoc($rsConn_2);
$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);
if(substr($_GET['type2'],0,1)=='C'){
if($str_no2==''){
$strSQL_1.=" and type_id ='-999' ";
}else{
$strSQL_1.=" and type_id IN($str_no2) ";
}
}else{
$strSQL_1.=" and type_id ='".$_GET['type2']."' ";
}
}
$strSQL_1.=" and import_status!='4' ";
$strSearch.="&year=".$_GET['year'];
}
if($_GET['type2']){
$strSearch.="&type2=".$_GET['type2'];
}
if($_GET['temp']){
if($_GET['temp']=='1'){
$strSQL_1.=" and import_status!='4' ";
}else if($_GET['temp']=='2'){
$strSQL_1.=" and import_status='4' ";
}
$strSearch.="&temp=".$_GET['temp'];
}
if($_GET['row']){
//$strSQL_1.=" and tempstop ='".(($_GET['temp']*1)-1)."' ";
$strSearch.="&row=".$_GET['row'];
}
$strSQL_1.=" ORDER BY industry_register.update_time DESC ";
//echo $strSQL_1;
?>
<table width="99%" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td width="76%">
<?php
$rsConn = mysql_db_query($dbname,$strSQL_1);
$all_row = mysql_num_rows($rsConn);
$board_row_per_page = 10;
$total_page = ceil($all_row/$board_row_per_page);
$page = ($_GET['page'])?$_GET['page']:1;
$page = ($page > $total_page)?$total_page:$page;
$page = ($page <= 0)?1:$page;
$limit_start = ($page==1)?0:(($page*$board_row_per_page)-$board_row_per_page);
$limit_end = $board_row_per_page;
if($View==''){
$strSQL_1 .= " LIMIT ".$limit_start.", ".$limit_end;
$num = $limit_start ;
}
if(isset($cols)&&isset($sort)){
$solink="&cols=$cols&sort=$sort";
}
$text_search = "";
$prev_page = $page - 1; $prev_page = ($prev_page <= 1)?1:$prev_page;
$prev = "self.location='".$PHP_SELF."?".$strSearch.$text_search."&search=$search&page=$prev_page$link$solink'";
$next_page = $page + 1; $next_page = ($next_page >= $total_page)?$total_page:$next_page;
$next = "self.location='".$PHP_SELF."?".$strSearch.$text_search."&search=$search&page=$next_page$link$solink'";
$prev_Tenpage=$page-$board_row_per_page;$prev_Tenpage=($prev_Tenpage<= 1)?1:$prev_Tenpage;
$prevTen = "self.location='".$PHP_SELF."?".$strSearch.$text_search."&search=$search&page=$prev_Tenpage$link$solink'";
$nextTenPage=$page+$board_row_per_page;$next_TenPage=($next_TenPage >= $total_page)?$total_page:$next_TenPage;
$nextTen = "self.location='".$PHP_SELF."?".$strSearch.$text_search."&search=$search&page=$nextTenPage$link$solink'";
?>
<? if($View==""){$Klink="?".$strSearch.$text_search."&View=All"; $CSh="ข้อมูลทั้งหมด"; $Klink2="?".$strSearch.$text_search."&View=";}else{$Klink="?".$strSearch.$text_search."&View=";$CSh="ข้อมูล ".$board_row_per_page." รายการล่าสุด";$Klink2="?".$strSearch.$text_search."&View=All";}?>
ทั้งหมด <b> <font color="#CC0000">
<?=number_format($all_row);?>
</font> </b> รายการ
<? if($View==""){?>
แบ่งเป็น <b><font color="#0033CC">
<?=number_format($total_page);?>
</font></b> หน้า
<? }?>
<a href="<?=$Klink?>"><img src="img/Search-Add.gif" alt="<?=$CSh?>" width="16" height="16" border="0" /></a>
<? if($View==''){?>
<? if($page==1){?>
<img src="img/page_div_icon/xFirst.gif" />
<? }else{?>
<img src="img/page_div_icon/First.gif" align="absmiddle" border="0" width="10" height="12" onclick="<?=$prevTen;?>" onMouseOver="style.cursor='hand';"/>
<? }?>
<? if($page==1){?>
<img src="img/page_div_icon/xPrevious.gif" />
<? }else{?>
<img src="img/page_div_icon/Previous.gif" align="absmiddle" border="0" width="7" height="12" onclick="<?=$prev;?>" onMouseOver="style.cursor='hand';"/>
<? }?>
<?php
$board_link_num = $board_row_per_page;
$ii = 1;
if ( $board_link_num > $total_page ){
$loop_page = $total_page;
} else {
$bx = ceil($board_link_num / 2);
$pp = $page - $bx;
$pn = $page + $bx;
$loop_page = $pn;
$ii = $pp;
if ( $total_page <= $loop_page ) {
$loop_page = $total_page;
$ii = $loop_page - ($board_link_num -1);
}
if ( $ii < 1 ) {
$ii = 1;
$loop_page = $ii + ($board_link_num -1);
}
}
for($i=$ii;$i<=$loop_page;$i++){
if ( $i==$page || !$page ) {
$txt = "<b>$i</b>";
} else {
$txt = $i;
}
?>
<a href="<?=$PHP_SELF;?>?Sort=<?=$Sort;?>&search=<?=$search?>&<?=$text_search?>&page=<?=$i;?><?=$strSearch;?>"><?=$txt;?>
</a>
<?
} # for
?>
<? if($page==$loop_page){?>
<img src="img/page_div_icon/xNext.gif" />
<? }else{?>
<img src="img/page_div_icon/Next.gif" align="absmiddle" border="0" width="7" height="12" onClick="<?=$next;?>" onMouseOver="style.cursor='hand';"/>
<? }?>
<? if($page==$loop_page){?>
<img src="img/page_div_icon/xLast.gif" />
<? }else{?>
<img src="img/page_div_icon/Last.gif" align="absmiddle" border="0" width="10" height="12" onClick="<?=$nextTen;?>" onMouseOver="style.cursor='hand';"/>
<?
}
}#End View=
?>
</td>
<td width="24%" align="right"></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" rowspan="2"><strong>ลำดับที่</strong></th>
<th rowspan="2" width="170"><font color="#FFFFFF"><strong>ชื่อโรงงาน</strong></font></th>
<!--<th width="160" rowspan="2"><font color="#FFFFFF"><strong>ที่ตั้งสำนักงาน</strong></font></th>-->
<th width="160" rowspan="2"><font color="#FFFFFF"><strong>ที่ตั้งโรงงาน</strong></font></th>
<th width="150" rowspan="2"><font color="#FFFFFF"><strong>หมวดอุตสาหกรรม</strong></font></th>
<th width="150" rowspan="2"><font color="#FFFFFF"><strong>ประเภทอุตสาหกรรม</strong></font></th>
<th width="130" rowspan="2"><font color="#FFFFFF"><strong>จำนวนเงินลงทุน<br>(ล้านบาท)</strong></font></th>
<td colspan="3"><font color="#FFFFFF"><strong>จำนวนคนงาน (คน)</strong></font></td>
<?
if($_GET['Wage']){
?>
<th width="80" rowspan="2"><font color="#FFFFFF"><strong>ปริมาณน้ำทิ้ง<br>(ลบ.ม. / ปี)</strong></font></th>
<? }?>
</tr>
<tr class="bg_th1">
<th width="60" align="center"><font color="#FFFFFF"><strong>รวม</strong></font></th>
<th width="60" align="center"><font color="#FFFFFF"><strong>ชาย</strong></font></th>
<th width="60" align="center"><font color="#FFFFFF"><strong>หญิง</strong></font></th>
</tr>
</thead>
<tbody>
<?
$rsConn_1 = mysql_db_query($dbname,$strSQL_1);
$i=0;
$total_CAPITAL=0;
$total_Men=0;
$total_WoMen=0;
$total_Man=0;
while ( $Result_1 = mysql_fetch_assoc($rsConn_1)) {
$i++;
$rowNumb = ($i+($board_link_num*$page)-$board_link_num);
$nameOffice=$Result_1['prename'].' '.$Result_1['aname'].' '.$Result_1['lname'];
if(substr($Result_1['office_tam'],0,2)=='ต.' || substr($Result_1['office_tam'],0,4)=='ตำบล'){
$nameOfficeTambol=$Result_1['office_tam'];
}else if($Result_1['office_tam']==''){
$nameOfficeTambol='';
}else{
$nameOfficeTambol='ต.'.$Result_1['office_tam'];
}
if(substr($Result_1['office_amp'],0,2)=='อ.' || substr($Result_1['office_amp'],0,5)=='อำเภอ'){
$nameOfficeAmphur=$Result_1['office_amp'];
}else if($Result_1['office_amp']==''){
$nameOfficeAmphur='';
}else{
$nameOfficeAmphur='อ.'.$Result_1['office_amp'];
}
if(substr($Result_1['office_wat'],0,2)=='จ.' || substr($Result_1['office_wat'],0,7)=='จังหวัด'){
$nameOfficeWat=$Result_1['office_wat'];
}else if($Result_1['office_wat']==''){
$nameOfficeWat='';
}else{
$nameOfficeWat='จ.'.$Result_1['office_wat'];
}
$locationOffice=$Result_1['officeadd1'].' '.$nameOfficeTambol.' '.$nameOfficeAmphur.' '.$nameOfficeWat.(($Result_1['office_zip']=='')?' ':' รหัสไปรษณีย์. ').$Result_1['office_zip'].$nameOfficeWat.(($Result_1['office_tel']=='')?' ':' โทร. ').$Result_1['office_tel'];
if(substr($Result_1['tambol'],0,2)=='ต.' || substr($Result_1['tambol'],0,4)=='ตำบล'){
$nameIndustryTambol=$Result_1['tambol'];
}else if($Result_1['tambol']==''){
$nameIndustryTambol='';
}else{
$nameIndustryTambol='ต.'.$Result_1['tambol'];
}
if(substr($Result_1['ampur'],0,2)=='อ.' || substr($Result_1['ampur'],0,5)=='อำเภอ'){
$nameIndustryAmphur=$Result_1['ampur'];
}else if($Result_1['ampur']==''){
$nameIndustryAmphur='';
}else{
$nameIndustryAmphur='อ.'.$Result_1['ampur'];
}
$locationIndustry=$Result_1['location'].' '.$nameIndustryTambol.' '.$nameIndustryAmphur.' จ.ปทุมธานี';
$strSQL_2 = "SELECT type_name,parent_id FROM industry_type WHERE type_id='".$Result_1['type_id']."' ";
$rsConn_2 = mysql_db_query($dbname,$strSQL_2);
$Result_2 = mysql_fetch_assoc($rsConn_2);
$strSQL_3 = "SELECT type_name FROM industry_type WHERE runid='".$Result_2['parent_id']."' ";
$rsConn_3 = mysql_db_query($dbname,$strSQL_3);
$Result_3 = mysql_fetch_assoc($rsConn_3);
//$Result_1['capital']=replaceToNumber(chkMilion($Result_1['capital']));
$total_CAPITAL+=$Result_1['capital'];
$total_Men+=$Result_1['men'];
$total_WoMen+=$Result_1['women'];
$total_Man+=$Result_1['man'];
?>
<tr bgcolor="#FFFFFF" onmouseover="this.style.backgroundColor='#dbf2ae'" onmouseout="this.style.backgroundColor='#FFFFFF'">
<td align="center"><?=$rowNumb?></td>
<td align="left"><?=$nameOffice?></td>
<?php /*?><td align="left"><?=$locationOffice?></td><?php */?>
<td align="left"><?=$locationIndustry?></td>
<td align="left"><?=$Result_3['type_name']?></td>
<td align="left"><?=$Result_2['type_name']?></td>
<td align="right"><?=number_format(replaceToNumber(chkMilion($Result_1['capital'])),2)?></td>
<td align="right"><?=number_format($Result_1['men'])?></td>
<td align="right"><?=number_format($Result_1['man'])?></td>
<td align="right"><?=number_format($Result_1['women'])?></td>
<?
if($_GET['Wage']){
?>
<td align="right"><?=number_format($Result_1['capital'],2)?></td>
<? }?>
</tr>
<? }?>
</tbody>
<tfoot>
<tr bgcolor="#DDDDDD">
<td colspan="5" align="right"><strong>รวม </strong></td>
<td align="right"><strong><?=number_format(replaceToNumber(chkMilion($total_CAPITAL)),2)?></strong></td>
<td align="right"><strong><?=number_format($total_Men)?></strong></td>
<td align="right"><strong><?=number_format($total_Man)?></strong></td>
<td align="right"><strong><?=number_format($total_WoMen)?></strong></td>
<?
if($_GET['Wage']){
?>
<td align="right"><strong><?=number_format($total_WoMen)?></strong></td>
<? }?>
</tr>
</tfoot>
</table>
<br />
<script type="text/javascript">
<!--
var TSort_Data = new Array ('my_table', '', 'h','','h','h','g','g','g','g');
var TSort_Classes = new Array ('row1', 'row2');
tsRegister();
// -->
</script>
<br />
</body>
</html>