|
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/people/ |
Upload File : |
<?
session_start();
include "../../config/config.inc.php";
include("function/function.php");
include ("graph.inc.php");
if(!isset($session_username)){
header("Location: ../document/login.php");
}
//include("header_menu.php");
//insert timeQuery
include("../../common/common_system.inc.php");
$ApplicationName="ecomplain";
$time_start = getmicrotime();
//insert timeQuery
$month_arr=array('','มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน','กรกฏาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม');
if($yy == ""){
$yy = date("Y");
}else{
$yy = $yy;
}
addlog("แสดงหน้ารายงานเรื่องที่ค้างดำเนินการจำแนกตามอำเภอ",$app_id,$act7); // add log
//$sql_re = "SELECT month( date_start ) as mm FROM tbl_complain_approve WHERE year( date_start )='$yy'";
$sql_re = "SELECT month(tbl_complain_approve.date_start ) as mm FROM tbl_complain_approve INNER JOIN tbl_complain_sent ON tbl_complain_approve.runid=tbl_complain_sent.com_app_id WHERE year(tbl_complain_approve.date_start)='$yy' AND (tbl_complain_sent.org_main=tbl_complain_sent.org_id) AND tbl_complain_sent.process_date_finish = '0000-00-00'";
//echo $sql_re;
$result_re = @mysql_db_query($dbname,$sql_re);
$num_c = @mysql_num_rows($result_re);
while($rs = @mysql_fetch_assoc($result_re)){
$Arr_report[$rs[mm]] = $Arr_report[$rs[mm]] +1;
}
$xmonth_arr = $month_arr;
for($m=1;$m<count($xmonth_arr);$m++){
if($daylist > "") $daylist .= ";";
if($data1 > "") $data1 .= ";";
$daylist .= $xmonth_arr[$m];
$data1 .= intval($Arr_report[$m]);
}
$txt_title = "สัดส่วนการรับเรื่องร้องทุกข์ที่ค้างดำเนินการจำแนกรายเดือน ปี ".($yy+543);
$graphurl = $graph_path . "?category=$daylist&data1=$data1&outputstyle=&numseries=1&seriesname=&graphtype=pie&title=$txt_title&xname=เดือน&yname=จำนวน(เรื่องร้องเรียน)&subtitle=&graphstyle=srd_sf_004.scs";
$w1 = 250;
$h1 = 150;
?>
<html>
<head>
<title><?=$show_title?></title>
<META http-equiv=Content-Type content="text/html; charset=windows-874">
<link href="../../common/style.css" type="text/css" rel="stylesheet" />
<script language='javascript' src='daily_popcalendar.js'></script>
<script language='javascript' src='displayelement.js'></script>
<style type="text/css">
<!--
body { margin: 0px 0px; padding: 0px 0px}
a:link { color: #005CA2; text-decoration: none}
a:visited { color: #005CA2; text-decoration: none}
a:active { color: #0099FF; text-decoration: underline}
a:hover { color: #0099FF; text-decoration: underline}
-->
</style>
<SCRIPT LANGUAGE="JavaScript">
function CheckForm(){
var f1 = document.form;
a = Number(f1.date_late.value) ;
missinginfo = "";
missinginfo1 = "";
if (document.form.subject.value == "") {missinginfo1 += "\n- กรุณากรอก เรื่องร้องเรียน "; }
if (document.form.subject_no_in.value == "") {missinginfo1 += "\n- กรุณากรอก เลขที่หนังสือ "; }
if (document.form.date_start.value == "") {missinginfo1 += "\n- กรุณากรอก วันเริ่มต้น "; }
if (document.form.date_end.value == "") {missinginfo1 += "\n- กรุณากรอก สิ้นสุด "; }
if (document.form.date_late.value == "") {missinginfo1 += "\n- กรุณากรอก จำนวนวันที่แจ้งเตือน"; }
if (a == null || !a.toString().match(/^[-]?\d*\.?\d*$/)){ missinginfo1 += "\n- กรุณากรอก วันที่แจ้งเตือนเป็นตัวเลขเท่านั้น "; }
if (missinginfo1 != "") {
missinginfo += "ไม่สามารถบันทึกข้อมูลได้ เนื่องจาก \n";
missinginfo +="_____________________________\n";
missinginfo = missinginfo + missinginfo1 ;
missinginfo += "\n___________________________";
missinginfo += "\nกรุณาตรวจสอบ อีกครั้ง";
alert(missinginfo);
return false;
}
}
</SCRIPT>
<script language="javascript">
function popWindow(url, w, h){
var popup = "Popup";
if(w == "") w = 420;
if(h == "") h = 300;
var newwin = window.open(url, popup,'location=0,status=no,scrollbars=no,resizable=no,width=' + w + ',height=' + h + ',top=20');
newwin.focus();
}
function popWindow1(url, w, h){
var popup = "Popup";
if(w == "") w = 420;
if(h == "") h = 300;
var newwin = window.open(url, popup,'location=0,status=no,scrollbars=no,resizable=no,width=' + w + ',height=' + h + ',top=20');
newwin.focus();
}
function popWindow2(url, w, h){
var popup = "Popup";
if(w == "") w = 420;
if(h == "") h = 300;
var newwin = window.open(url, popup,'location=0,status=no,scrollbars=no,resizable=no,width=' + w + ',height=' + h + ',top=20');
newwin.focus();
}
</script>
<script language="javascript">
function clearselect()
{
document.post.salary_day.disabled=true;
document.post.salary_month.disabled=true;
document.post.salary_year.disabled=true;
document.post.label_date.disabled=true;
if (document.post.salary_day.value!="")
{
document.post.salary_day.value="";
document.post.salary_day.disabled=true;
}
if (document.post.salary_month.value!="")
{
document.post.salary_month.value="";
document.post.salary_month.disabled=true;
}
if (document.post.salary_year.value!="")
{
document.post.salary_year.value="";
document.post.salary_year.disabled=true;
}
if (document.post.label_date.value!="")
{
document.post.label_date.value="";
document.post.label_date.disabled=true;
}
}
</script>
</head>
<body >
<form name="form1" method="post" action="">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td valign="top" background="bimg/bg1.gif" style="background-repeat: no-repeat; background-position:right bottom ">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="middle"> </td>
<td align="center"> </td>
<td align="center"> </td>
</tr>
<tr>
<td width="6%" align="center" valign="middle"> </td>
<td width="89%" align="center"><label></label></td>
<td width="5%" align="center"><img src="../../images/element_previous.png" width="24" height="24" alt="กลับหน้าหลัก" onClick="location.href='report_main.php'" style="cursor:hand"></td>
</tr>
</table>
</td>
</tr>
<?php
$sql_sum = "select count(*) as tot , ";
$sql_sum .= "sum(case when (not status is null and trim(status)<>'') then 1 else 0 end) as help_count ";
$amphur_id = $_GET['aumphur_id'];
if($amphur_id !='')
{
$sql_tamboon = " AND ca.ccDigi Like('$amphur_id%') AND ca.ccType='Tamboon' ";
$sql_sum .=" from ccaa ca inner join tbl_complain tc on ca.ccdigi = tc.public_tambol";
}
else
{
$sql_sum .=" from ccaa ca inner join tbl_complain tc on ca.ccdigi = tc.public_amphur";
}
$sql_sum .=" where tc.public_province='13000000' and tc.yy='$sel_year' and tc.request_level in(1,2,3) ".$sql_tamboon;
//echo $sql_sum;
$res_sum = mysql_query($sql_sum);
$rs_sum = mysql_fetch_assoc($res_sum);
?>
<tr>
<td align="center" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right" valign="top" > </td>
<td align="left" valign="top"> </td>
</tr>
<tr>
<td width="38%" align="right" valign="top" ><strong>จำนวนปัญหาทั้งหมด </strong></td>
<td width="62%" align="left" valign="top">:: <?=$rs_sum['tot']?></td>
</tr>
<tr>
<td align="right" valign="top"><strong>จำนวนการให้ความช่วยเหลือ</strong> </td>
<td align="left" valign="top">:: <?=$rs_sum['help_count']?></td>
</tr>
<tr>
<td align="right" valign="top"><strong>คิดเป็นร้อยละ</strong> </td>
<td align="left" valign="top">:: <?=number_format($rs_sum['help_count']*100/$rs_sum['tot'],2)?></td>
</tr>
<tr>
<td colspan="2" valign="top"> <strong>
<?
if($_GET['aumphur_id'] != '')
{
echo "<a href=\"report_stat_aumpur.php?sel_year=".$sel_year."\"><< อำเภอ ".$_GET[aumphur_name]." </a>";
//echo "<a href=\"javascript:form1.submit();\">".ระดับอำเภอ."</a>";
}
?>
</strong>
</td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" bgcolor="#000000"><table width="100%" border="0" cellspacing="1" cellpadding="5">
<tr>
<td colspan="17" align="center" bgcolor="#BDC9F9"><strong>การรับเรื่องความต้องการจำแนกตามอำเภอ ปี
<?=$yy+543?>
</strong></td>
</tr>
<tr>
<td align="center" bgcolor="#BDC9F9" rowspan="2"><div align="center"><strong><?=$_GET[aumphur_id] != '' ? 'ตำบล' : 'อำเภอ'?></strong></div></td>
<td align="center" bgcolor="#BDC9F9" colspan="4"><div align="center"><strong>ระดับความต้องการมาก</strong></div></td>
<td align="center" bgcolor="#BDC9F9" colspan="4"><div align="center"><strong>ระดับความต้องการปานกลาง</strong></div></td>
<td align="center" bgcolor="#BDC9F9" colspan="4"><div align="center"><strong>ระดับความต้องการน้อย</strong></div></td>
<td align="center" bgcolor="#BDC9F9" colspan="3"><div align="center"><strong>รวม</strong></div></td>
</tr>
<tr>
<td align="center" bgcolor="#BDC9F9">ได้รับ</td>
<td align="center" bgcolor="#BDC9F9">ไม่ได้รับ</td>
<td align="center" bgcolor="#BDC9F9">รวม</td>
<td align="center" bgcolor="#BDC9F9">ร้อยละ</td>
<td align="center" bgcolor="#BDC9F9">ได้รับ</td>
<td align="center" bgcolor="#BDC9F9">ไม่ได้รับ</td>
<td align="center" bgcolor="#BDC9F9">รวม</td>
<td align="center" bgcolor="#BDC9F9">ร้อยละ</td>
<td align="center" bgcolor="#BDC9F9">ได้รับ</td>
<td align="center" bgcolor="#BDC9F9">ไม่ได้รับ</td>
<td align="center" bgcolor="#BDC9F9">รวม</td>
<td align="center" bgcolor="#BDC9F9">ร้อยละ</td>
<td align="center" bgcolor="#BDC9F9">ได้รับ</td>
<td align="center" bgcolor="#BDC9F9">ไม่ได้รับ</td>
<td align="center" bgcolor="#BDC9F9">รวม</td>
</tr>
<?php
$tot_top_help = 0;
$tot_top_no_help = 0;
$tot_all_top = 0;
$tot_mid_help = 0;
$tot_mid_no_help = 0;
$tot_all_mid = 0;
$tot_foot_help = 0;
$tot_foot_no_help = 0;
$tot_all_foot = 0;
$tot_all_help =0;
$tot_all_no_help=0;
$tot_all = 0;
// echo $amphur_id."<br>";
$sql_tambon = '';
if($amphur_id !='')
{
$sql_select = "select ca.ccName ,tc.public_tambol as ccDigi, ";
}else
{
$sql_select = "select ca.ccName ,tc.public_amphur as ccDigi, ";
}
$sql_select .=" sum(case when tc.request_level=3 and tc.status<>'' and not tc.status is null then 1 else 0 end) as top_help,";
$sql_select .=" sum(case when tc.request_level=3 and (tc.status='' or tc.status is null) then 1 else 0 end) as top_no_help,";
$sql_select .=" sum(case when tc.request_level=2 and tc.status<>'' and not tc.status is null then 1 else 0 end) as mid_help,";
$sql_select .=" sum(case when tc.request_level=2 and (tc.status='' or tc.status is null) then 1 else 0 end) as mid_no_help,";
$sql_select .=" sum(case when tc.request_level=1 and tc.status<>'' and tc.status is null then 1 else 0 end) as foot_help,";
$sql_select .=" sum(case when tc.request_level=1 and (tc.status='' or tc.status is null) then 1 else 0 end) as foot_no_help";
if($amphur_id !='')
{
$sql_tambon = " AND ca.ccDigi Like('$amphur_id%') AND ca.ccType='Tamboon' ";
$sql_select .=" from ccaa ca inner join tbl_complain tc on ca.ccdigi = tc.public_tambol";
}
else
{
$sql_select .=" from ccaa ca inner join tbl_complain tc on ca.ccdigi = tc.public_amphur";
}
$sql_select .=" where tc.public_province='13000000' and tc.yy='$sel_year' and tc.request_level in(1,2,3) ".$sql_tambon;
$sql_select .=" group by ca.ccname,ca.ccDigi";
//echo $sql_select;
$am = mysql_query($sql_select);
$arr_percent = array();
while( $ram = mysql_fetch_array($am) ) {
$tot_top_help +=$ram['top_help'];
$tot_top_no_help +=$ram['top_no_help'];
$tot_all_top =$ram['top_help']+$ram['top_no_help'];
$arr_percent[0] = $tot_all_top;
$tot_mid_help +=$ram['mid_help'];
$tot_mid_no_help +=$ram['mid_no_help'];
$tot_all_mid =$ram['mid_help']+$ram['mid_no_help'];
$arr_percent[1] = $tot_all_mid;
$tot_foot_help +=$ram['foot_help'];
$tot_foot_no_help +=$ram['foot_no_help'];
$tot_all_foot +=$ram['foot_help']+$ram['foot_no_help'];
$arr_percent[2] = $tot_all_foot;
$tot_all_help +=$ram['top_help']+$ram['mid_help']+$ram['foot_help'];
$tot_all_no_help +=$ram['top_no_help']+$ram['mid_no_help']+$ram['foot_no_help'];
$tot_all += $ram['top_help']+$ram['mid_help']+$ram['foot_help']+$ram['top_no_help']+$ram['mid_no_help']+$ram['foot_no_help'];
$arr_result = percentage($arr_percent);
?>
<tr >
<td align="center" bgcolor="#FFFFFF">
<div align="left">
<?
if($_GET['aumphur_id']=='')
{
?>
<a href="report_stat_aumpur.php?aumphur_id=<?=substr($ram['ccDigi'],0,4)?>&aumphur_name=<?=$ram['ccName']?>">
<?=$ram['ccName']?>
</a>
<?
}
else
{
?>
<?=$ram['ccName']?>
<?
}
?>
</div></td>
<td align="center" bgcolor="#FFFFFF">
<div align="right">
<?php
$t1 = "<a href=\"report_stat_aumpur.php?aumphur_id=".substr($ram['ccDigi'],0,4)."&tambon=".$ram['ccDigi']."\">";
$t2 = "</a>";
if($ram['top_help'] > 0)
{
echo $t1.$ram['top_help'].$t2;
}
else
{
echo $ram['top_help'];
}
?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?= $ram['top_no_help'] > 0 ? $t1.$ram['top_no_help'].$t2 :"0"?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$ram['top_help']+$ram['top_no_help']?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<strong><?=$arr_result[0]?></strong>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$ram['mid_help']?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$ram['mid_no_help']?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$ram['mid_help']+$ram['mid_no_help']?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<strong><?=$arr_result[1]?></strong>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$ram['foot_help']?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$ram['foot_no_help']?>
</div></td>
<td align="center" bgcolor="#FFFFFF"><div align="right">
<?=$ram['foot_help']+$ram['foot_no_help']?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<strong><?=$arr_result[2]?></strong>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$ram['top_help']+$ram['mid_help']+$ram['foot_help']?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$ram['top_no_help']+$ram['mid_no_help']+$ram['foot_no_help']?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$ram['top_help']+$ram['mid_help']+$ram['foot_help']+$ram['top_no_help']+$ram['mid_no_help']+$ram['foot_no_help']?>
</div></td>
</tr>
<?
}
if($arr_result > 0)
{
$arr_percent[0] = $tot_top_help+$tot_top_no_help;
$arr_percent[1] = $tot_mid_help+$tot_mid_no_help;
$arr_percent[2] = $tot_foot_help+$tot_foot_no_help;
$arr_result = percentage($arr_percent);
}
?>
<tr >
<td align="left" bgcolor="#FFFFFF">รวม</td>
<td align="center" bgcolor="#FFFFFF"><div align="right">
<?=$tot_top_help?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$tot_top_no_help?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$tot_top_help+$tot_top_no_help?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<strong><?=$arr_result[0]?></strong>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$tot_mid_help?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$tot_mid_no_help?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$tot_mid_help+$tot_mid_no_help?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<strong><?=$arr_result[1]?></strong>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$tot_foot_help?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$tot_foot_no_help?>
</div></td>
<td align="center" bgcolor="#FFFFFF"><div align="right">
<?=$tot_foot_help+$tot_foot_no_help?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<strong><?=$arr_result[2]?></strong>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$tot_all_help?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$tot_all_no_help?>
</div></td>
<td align="center" bgcolor="#FFFFFF" ><div align="right">
<?=$tot_all?>
</div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>
<?
//insert timeQuery
$time_end = getmicrotime();
writetime2db($timestart,$time_end);
//insert timeQuery
?>