|
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 : /var/www/html/pathumthani_integration/requirement/application/people/ |
Upload File : |
<?
session_start();
include "../../config/config.inc.php";
include("function/function.php");
//insert timeQuery
include("../../common/common_system.inc.php");
$ApplicationName="ecomplain";
$time_start = getmicrotime();
//insert timeQuery
/*if($_POST){
echo "<pre>";
print_r($_POST);
echo "</pre>";
exit();
}*/
$staffid=$_SESSION[session_staffid];
function mail_daily_request($title_name,$email_to,$email_from,$msgtext,$refid=''){
global $PHP_SELF;
//require_once "Mail.php";
require_once("class.phpmailer.php");
//$msg= "MIME-Version: 1.0\r\n";
//$msg .= "Content-type: text/html; charset=tis-612\r\n";
$msg .= "
<head>
<title> HTML content</title>
</head>
<body>".ereg_replace(chr(13),"<br>", $msgtext)."</body>
</html>
";
$from = $email_from;
$to = $email_to;
$subject = iconv('TIS-620', 'UTF-8',$title_name);
$msg = iconv('TIS-620', 'UTF-8',$msg);
//$subject = $title_name;
$body = $msg;
$host = "mail.sapphire.co.th";
$username = "system@sapphire.co.th";
$password = "sapphire";
$content=" text/html; charset=utf-8";
###################### NEW MAILLER 5.1
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->CharSet ="utf-8";
$mail->IsSMTP();
$mail->Host ="mail.sapphire.co.th";
$mail->Port=25;
$mail->Username = $username; // SMTP username
$mail->Password = $password; // SMTP password
$mail->From = "$from";
$mail->FromName = iconv('TIS-620', 'UTF-8',"ระบบคลังข้อมูลปัญหาความต้องการของประชาชน");
$mail->AddAddress("$to");
$mail->AddReplyTo("$from");
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "$subject";
$mail->Body = "$msg";
//$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
//echo "$subject"."$msg";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
###################### END MAILLER 5.1
}
if($type_user == "gov"){
$txt_type_user = "0"; // เจ้าหน้าที่ของรัฐ
}else{
$txt_type_user = "1";// ประชาชน
}
if($_SESSION[province_code] != ""){
$province_code = $_SESSION[province_code];
}else{
$province_code = "13000000"; // defult จังหวัดปทุม
$ran_str = randomstr(6); /// random รหัสรูปภาพ
$curent_mm =date("m");
$curent_yy = date("Y");
if($type_user != ""){
include("header_menu.php");
}
if ($_SERVER[REQUEST_METHOD] == "POST"){
if($Aaction == "SAVE"){
// วันเริ่มต้นช่วงเกิดเหต
if($rdodate == "0")
{
$act_start_date = $act_start_date0;
$act_end_date = "";
}
if($act_start_date != ""){
$arr_dt1 = explode("/",$act_start_date);
$act_sd = ($arr_dt1[2]-543)."-".$arr_dt1[1]."-".$arr_dt1[0];
}else{
$act_sd = "0000-00-00";
}
// ถึงวันที่สิ้นสุด
if($act_end_date != ""){
$arr_dt2 = explode("/",$act_end_date);
$act_ed = ($arr_dt2[2]-543)."-".$arr_dt2[1]."-".$arr_dt2[0];
}else{
$act_ed = "0000-00-00";
}
// วันที่รับเรื่อง
if($accept_date != ""){
$arr_dt3 = explode("/",$accept_date);
$act_ad = ($arr_dt3[2]-543)."-".$arr_dt3[1]."-".$arr_dt3[0];
}else{
$act_ad = "0000-00-00";
}
## รหัส Ticket ID ที่จะบันทึกเข้าสู่ระบบ
$Tic_TYY = substr((date("Y")+543),-2);
$Ticket_ID = $Tic_TYY.date("md")."T".date("His");
// echo"<pre>";print_r($_POST);die;
//------------------------------------------------------------- บันทึกข้อมูลติดตามเรื่องร้องเรียน
####### USER INFOMATION
$info=$_SERVER['HTTP_USER_AGENT'];
$info=str_replace("(","",$info);
$info=str_replace(")","",$info);
$arr_info=explode(" ",$info);
$user_info[client_ip]=$REMOTE_ADDR;
$user_info[browser].=$arr_info[0];
$user_info[browser]=$arr_info[2];
$user_info[browser_version]=str_replace(";","",$arr_info[3]);
$user_info[os]=$arr_info[4]." ".$arr_info[5];
$user_info[os_version]=$arr_info[6];
$arrDate = explode("-",$TimeLineDate);
$TimeLineDate = ($arrDate [2]-543)."-".$arrDate['1']."-".$arrDate [0];
/*$sql_insert = "
INSERT INTO
tbl_complain set
complain_id='$Ticket_ID',
mm='$curent_mm',
yy='$curent_yy',
public_writen = '$public_writen',
public_name = '$public_name',
public_age = '$public_age',
public_job = '$public_job',
public_address = '$public_address',
public_moo = '$public_moo',
public_tambol = '$public_tambol',
public_amphur = '$public_amphur',
public_province = '$public_province',
public_zipcode = '$public_zipcode',
public_phone = '$public_phone',
public_email = '$public_email',
public_idcard='$public_idcard',
type_request = '$type_problem',
problem_comment = '$problem_comment',
complain_detail = '$complain_detail',
type_process = '$type_process',
process_comment = '$process_comment',
keyin_time = now(),
status_show_owner='$status_show_owner',
accept_date='$accept_date',
feedback='$feedback',
type_user='$txt_type_user',
client_ip='$user_info[client_ip]',
client_browser='$user_info[browser]',
client_browser_version='$user_info[browser_version]',
client_os='$user_info[os]',
client_os_version='$user_info[os_version]',
request_level='$type_level',
public_longtitude='$longtitude',
public_latitude='$lattitude',
// echo '<pre>'.$sql_insert;die;
$result_insert = mysql_db_query($dbname,$sql_insert);
$insert_id = $Ticket_ID; // รหัสล่าสุดที่มีการเพิ่มข้อมูล
// กรณี เจ้าหน้าที่ login เข้ามากรอกข้อมูล
/$sql_insert_gov = "INSERT INTO tbl_complain_approve SET complain_id='$insert_id', org_code='$org_code',subject='$complain_detail',type_problem='$type_problem',office_id='$office_id',ministry='$ministry',//department='$department',accept_date='$txt_date_accept' ";
// end กรณีเจ้าหน้าที่ login เข้ามากรอก*/
$count_file = count($file_act);// นับจำนวนไฟล์ที่แนบเข้ามา
for($i = 0; $i < $count_file; $i++){ // ทำการวน loop เพื่อบันทึกไฟล์แนบ
if(!empty($file_act[$i])){
$yymmdd = (date("Ymd")).$insert_id."_".randigit(5);
$path_name = "../../attach_file/";
$arrfileext = explode("." , $file_act_name[$i]) ;
$nmcount = count($arrfileext) - 1 ;
$file1ext = $arrfileext[$nmcount] ;
$server_filename = $yymmdd.".$file1ext" ;
$save_path = $path_name.$server_filename;
if (copy( $file_act[$i] , $save_path )){
$sql_insert_file = "INSERT INTO tbl_attachfile SET complain_id='$insert_id',act_file='$save_path',note_file='$note_file[$i]'";
$result_insert_file = mysql_db_query($dbname,$sql_insert_file);
}// end if (copy( $url_file , $save_path )){
} // end if(!empty($file_act[$i])){
}// end for(){
if($result_insert){
if($type_user != ""){
addlog("บันทึกความต้องการของประชาชน โดยเจ้าหน้าที่",$app_id,$act1,$insert_id); // add log
echo "
<script language=\"javascript\">
alert(\"ทำการบันทึกข้อมูลเสร็จสิ้น ! \\n \");
location.href='add.php';
</script>
";
exit();
}else{
addlog("บันทึกความต้องการของประชาชน",$app_id,$act1,$insert_id); // add log
echo "
<script language=\"javascript\">
alert(\"ทำการบันทึกข้อมูลเสร็จสิ้น ! \\n \");
location.href='add.php';
</script>
";
exit();
} // end if($type_user != "")
}// end if($result_insert)
} // end if($Aaction == "SAVE")
if($ActionF == "DEL_FILE"){
$sql_select = "SELECT *FROM tbl_attachfile WHERE complain_id='$Ticket_ID'";
$result_select = mysql_db_query($dbname,$sql_select);
$rs_s = mysql_fetch_assoc($result_select);
if($rs_s[act_file] != ""){
@unlink($rs_s[act_file]);
}
$sql_del = "DELETE FROM tbl_attachfile WHERE complain_id='$Ticket_ID'";
$result_del = mysql_db_query($dbname,$sql_del);
if($result_del){
addlog("ลบไฟล์แนบเรื่องร้องเรียน-ร้องทุกข์",$app_id,$act3,$id); // add log
echo "
<script language=\"javascript\">
location.href='form_edit_data.php?complain_id=$complain_id';
</script>
";
exit();
}else{
addlog("พยายามลบไฟล์แนบเรื่องร้องเรียน-ร้องทุกข์",$app_id,$act3,$id); // add log
echo "
<script language=\"javascript\">
alert(\"ไม่สามารถลบไฟล์ได้\\n \");
location.href='form_edit_data.php?complain_id=$complain_id';
</script>
";
exit();
}
}
// แก้ไขรายการข้อมูล
if($Aaction == "SAVE_EDIT"){
$insert_id = $_POST['insert_id'];
$dd=$_GET[TimeLineDate];
if($rdodate == "0")
{
$act_start_date = $act_start_date0;
$act_end_date = "";
}
if($act_start_date != ""){
$arr_dt1 = explode("/",$act_start_date);
$act_sd = ($arr_dt1[2]-543)."-".$arr_dt1[1]."-".$arr_dt1[0];
}else{
$act_sd = "0000-00-00";
}
// ถึงวันที่สิ้นสุด
if($act_end_date != ""){
$arr_dt2 = explode("/",$act_end_date);
$act_ed = ($arr_dt2[2]-543)."-".$arr_dt2[1]."-".$arr_dt2[0];
}else{
$act_ed = "0000-00-00";
}
// วันที่รับเรื่อง
if($accept_date != ""){
$arr_dt3 = explode("/",$accept_date);
$act_ad = ($arr_dt3[2]-543)."-".$arr_dt3[1]."-".$arr_dt3[0];
}else{
$act_ad = "0000-00-00";
}
$arrDate = explode("-",$TimeLineDate);
$TimeLineDate = ($arrDate [2]-543)."-".$arrDate['1']."-".$arrDate [0];
$sql_update = "
UPDATE tbl_complain SET
time_add='$TimeLineDate',
public_writen = '$public_writen',
public_age = '$public_age',
public_job = '$public_job',
public_address = '$public_address',
public_moo = '$public_moo',
public_tambol = '$public_tambol',
public_amphur = '$public_amphur',
public_province = '$public_province',
public_zipcode = '$public_zipcode',
public_phone = '$public_phone',
public_idcard='$public_idcard',
type_request = '$type_problem',
problem_comment = '$problem_comment',
complain_detail = '$complain_detail',
type_process = '$type_process',
process_comment = '$process_comment',
keyin_time = now(),
status_show_owner='$status_show_owner',
accept_date='$accept_date',
feedback='$feedback',
client_ip='$user_info[client_ip]',
client_browser='$user_info[browser]',
client_browser_version='$user_info[browser_version]',
client_os='$user_info[os]',
client_os_version='$user_info[os_version]',
request_level='$type_level',
public_longtitude='$longtitude',
public_latitude='$lattitude',
nid='$nid',
staffid='$staffid'
WHERE complain_id='$insert_id'";
//echo "<pre>".$sql_update;die;
$result_update = mysql_db_query($dbname,$sql_update);
$count_file = count($file_act);// นับจำนวนไฟล์ที่แนบเข้ามา
for($i = 0; $i < $count_file; $i++){ // ทำการวน loop เพื่อบันทึกไฟล์แนบ
if(!empty($file_act[$i])){
$yymmdd = (date("Ymd")).$insert_id."_".randigit(5);
$path_name = "attach_file/";
$arrfileext = explode("." , $file_act_name[$i]) ;
$nmcount = count($arrfileext) - 1 ;
$file1ext = $arrfileext[$nmcount] ;
$server_filename = $yymmdd.".$file1ext" ;
$save_path = $path_name.$server_filename;
if (copy( $file_act[$i] , $save_path )){
$sql_insert_file = "INSERT INTO tbl_attachfile SET complain_id='$insert_id',act_file='$save_path',note_file='$note_file[$i]',type='1'";
$result_insert_file = mysql_db_query($dbname,$sql_insert_file);
}// end if (copy( $url_file , $save_path )){
} // end if(!empty($file_act[$i])){
}// end for(){
##########################################
#ส่งอีเมล์ให้กับประชาชน
#########################################
$sql_get_mail = "SELECT * FROM tbl_complain WHERE complain_id ='$insert_id' ";
$result_get_mail = mysql_db_query($dbname,$sql_get_mail);
$rs_t = mysql_fetch_assoc($result_get_mail);
if($rs_t['public_email'] != ""){
if($nid != ""){
$msgtext = "ปัญหาที่ท่านแจ้งมาทางอำเภอได้ส่งเรื่องให้หน่วยงานที่ต้องดำเนินการแก้ไขเรียบร้อยแล้ว";//เนื้อหาที่ต้องการส่ง
$workname="แจ้ง : คุณ".$rs_t['public_name'];
$email_sys = "system@sapphire.co.th";//เมล์ เว็บเรา
$staff_mail = trim($rs_t['public_email']);//เมล์ที่ต้องการส่ง
$id = "";
mail_daily_request($workname, $staff_mail , $email_sys ,$msgtext,$id);
}
}
if($result_update){
if($result_update!= ""){
addlog("แก้ไขเรื่องเรียน - ร้องทุกข์ โดยเจ้าหน้าที่",$app_id,$act1,$insert_id); // add log
echo "
<script language=\"javascript\">
alert(\"ทำการบันทึกข้อมูลเสร็จสิ้น ! \\n \");
location.href='index.php';
</script>
";
//location.href='report_index.php?senttab=$senttab';
exit();
}else{
addlog("แก้ไขเรื่องเรียน - ร้องทุกข์ โดยประชาชน",$app_id,$act1,$insert_id); // add log
echo "
<script language=\"javascript\">
alert(\"ทำการบันทึกข้อมูลเสร็จสิ้น ! ท่านจะได้ Ticket_ID เพื่อตรวจสอบสถานะเรื่องร้องเรียนจากระบบ\\n \");
location.href='index.php';
</script>
";
exit();
}// end if($type_user != ""){<strong></strong>
}// end if($result_update){
}
} //end post
?><HTML>
<HEAD>
<TITLE><?=$show_title_comp?></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>
<link rel="stylesheet" type="text/css" href="calendar/style.css" />
<div>
<link rel="stylesheet" type="text/css" href="hiliterow.css" />
<div>
<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}
.style3 {color: #FF0000}
.p_border{
border-bottom:2 solid #DADCED;
}
-->
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function handleStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
updateproductList();
}
}
}
function updateproductList() {
clearproductList();
var department = document.getElementById("alleg_department");
var results = xmlHttp.responseText;
var option = null;
p=results.split(",");
option = document.createElement("option");
option.setAttribute("value",0);
option.appendChild(document.createTextNode("ไม่ระบุ"));
department.appendChild(option);
for (var i = 0; i < p.length; i++){
if(p[i] > ""){
x = p[i].split("::");
option = document.createElement("option");
option.setAttribute("value",x[1]);
option.appendChild(document.createTextNode(x[0]));
department.appendChild(option);
}
}
}
function clearproductList() {
var department = document.getElementById("alleg_department");
while(department.childNodes.length > 0) {
department.removeChild(department.childNodes[0]);
}
}
function refreshproductList() {
var ministry = document.getElementById("alleg_ministry").value;
if(ministry == "" ) {
clearproductList();
return;
}
var url = "ajax_minitry.php?ministry_id=" + ministry;
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}
var gFiles = 0;
function addFile() {
var subS = "คำอธิบายไฟล์ : ";
var subS1 = " ไฟล์แนบ : ";
var li = document.createElement('li');
li.setAttribute('id', 'file-' + gFiles);
li.innerHTML = subS+'<input type="text" name="note_file[]" size="30">'+subS1+'<input type="file" name="file_act[]" size="20" ><span onclick="removeFile(\'file-' + gFiles + '\')" style="cursor:pointer;"> <img src=../../images/profile_expanded.gif border=0></span>';
document.getElementById('files-root').appendChild(li);
gFiles++;
}
function removeFile(aId){
var obj = document.getElementById(aId);
obj.parentNode.removeChild(obj);
}
/// function check เลขบัตร
function checkID(id) {
if(id.length != 13) return false;
for(i=0, sum=0; i < 12; i++)
sum += parseFloat(id.charAt(i))*(13-i);
if((11-sum%11)%10!=parseFloat(id.charAt(12))) return false;
return true;
}
// end function check เลขบัตร
function CheckForm(){
var type_u = document.getElementById("type_user").value;
// alert (document.form.type_problem.value);
if(document.form.type_problem.value == "6"){
if(document.form.problem_comment.value == ""){
alert(" ! กรุณาระบุรายละเอียดเรื่องร้องเรียน ");
document.form.problem_comment.focus();
return false;
}
}
if(document.form.type_process.value == "5"){
if(document.form.process_comment.value == ""){
alert(" ! กรุณาระบุรายละเอียดการดำเนินการที่ต้องการ ");
document.form.process_comment.focus();
return false;
}
}
if(document.form.public_name.value == ""){
alert(" !กรุณาระบุชื่อ - สกุล ผู้ถูกร้องเรียน");
document.form.public_name.focus();
return false;
}else if(document.form.type_problem.value == ""){
alert(" !กรุณาระบุประเภทเรื่องร้องเรียน ");
document.form.type_problem.focus();
return false;
}else if(document.form.complain_detail.value == ""){
alert(" !กรุณาระบุข้อกล่าวหา / ข้อร้องเรียน");
document.form.complain_detail.focus();
return false;
}else if(document.form.type_process.value == ""){
alert(" !กรุณาระบุประเภทดำเนินการ ");
document.form.type_process.focus();
return false;
}else{
if(type_u != "gov"){
if(document.form.public_name.value == ""){
alert(" ! กรุณาระบุชื่อของท่านด้วยครับ");
document.form.public_name.focus();
return false;
}else if(!checkID(document.form.public_idcard.value)){
alert(" ! เลขบัตรประจำตัวของท่านไม่ถูกต้องตามกรมการปกครอง กรุณาระบุใหม่อีกครั้ง");
document.form.public_idcard.focus();
return false;
}else if(document.form.char_code.value == ""){
alert(" !กรุณาระบุรหัสภาพ");
document.form.char_code.focus();
return false;
}
}else{
return true;
}
}
}
</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();
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
function Check_imgcode(){
var hidcode = document.getElementById("hid_code").value;
var charcode = document.getElementById("char_code").value;
if(hidcode != charcode){
alert("ท่านกรอกรหัสภาพไม่ถูกต้องกรุณาระบุรหัสภาพใหม่อีกครับ");
document.form.char_code.focus();
return false;
}else{
return true;
}
}
function Filter_Keyboard() {
var keycode = window.event.keyCode;
if( keycode >=37 && keycode <=40 ) return true; // arrow left, up, right, down
if( keycode >=48 && keycode <=57 ) return true; // key 0-9
if( keycode >=96 && keycode <=105 ) return true; // numpad 0-9
if( keycode ==110 || keycode ==190 ) return true; // dot
if( keycode ==8 ) return true; // backspace
if( keycode ==9 ) return true; // tab
if( keycode ==45 || keycode ==46 || keycode ==35 || keycode ==36) return true; // insert, del, end, home
return false;
}
function keyother(){
var tr_id = document.getElementById("alleg_office_id").value;
if(tr_id == "other"){
document.getElementById("tr1").style.display = "";
}else{
document.getElementById("tr1").style.display = "none";
}
}
function show_com_detail(){
document.getElementById("tbl_detail").style.display="";
}
//@add 2009/06/06 @author Kridsada
function toDisble(rdo)
{
var value = rdo.value;
if(value == "0")
{
document.getElementById("act_start_date").disabled = true;
document.getElementById("button1").disabled = true;
document.getElementById("act_end_date").disabled = true;
document.getElementById("button2").disabled = true;
document.getElementById("act_start_date0").disabled = false;
document.getElementById("button0").disabled = false;
}else if(value == "1")
{
document.getElementById("act_start_date").disabled = false;
document.getElementById("button1").disabled = false;
document.getElementById("act_end_date").disabled = false;
document.getElementById("button2").disabled = false;
document.getElementById("act_start_date0").disabled = true;
document.getElementById("button0").disabled = true;
}
}
</SCRIPT>
<SCRIPT language="javascript1.2">
function CreateXmlHttp(){
//Creating object of XMLHTTP in IE
try {
XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(oc) {
XmlHttp = null;
}
}
//Creating object of XMLHTTP in Mozilla and Safari
if(!XmlHttp && typeof XMLHttpRequest != "undefined") {
XmlHttp = new XMLHttpRequest();
}
} // end function CreateXmlHttp
function chgAmphur(e, defa_v, tambon) {
if ( e ) {
CreateXmlHttp();
XmlHttp.open("get", "ajax.chgamphur.php?PvID="+e+"&DfVal="+defa_v, true);
XmlHttp.onreadystatechange=function() {//alert("Aussy!!");
if (XmlHttp.readyState==4) {
if (XmlHttp.status==200) {
var res = XmlHttp.responseText; //alert(res);
document.getElementById("lblAmphur").innerHTML = res;
chgTambon(defa_v, tambon);
} else if (XmlHttp.status==404) {
alert("ไม่สามารถทำการดึงข้อมูลได้");
} else {
alert("Error : "+XmlHttp.status);
}
}
};
XmlHttp.send(null);
}
}
function chgTambon(e, defa_v) {
if ( e ) {
CreateXmlHttp();
XmlHttp.open("get", "ajax.chgtambon.php?TbID="+e+"&DfVal="+defa_v, true);
XmlHttp.onreadystatechange=function() {
if (XmlHttp.readyState==4) {
if (XmlHttp.status==200) {
var res = XmlHttp.responseText; //alert(res);
document.getElementById("lblTambon").innerHTML = res;
} else if (XmlHttp.status==404) {
alert("ไม่สามารถทำการดึงข้อมูลได้");
} else {
alert("Error : "+XmlHttp.status);
}
}
};
XmlHttp.send(null);
}
}
function chgMoo(e, defa_v) {
if ( e ) {
CreateXmlHttp();
XmlHttp.open("get", "ajax.chgmoo.php?MooID="+e+"&DfVal="+defa_v, true);
XmlHttp.onreadystatechange=function() {
if (XmlHttp.readyState==4) {
if (XmlHttp.status==200) {
var res = XmlHttp.responseText; alert(res);
document.getElementById("lblMoo").innerHTML = res;
} else if (XmlHttp.status==404) {
alert("ไม่สามารถทำการดึงข้อมูลได้");
} else {
alert("Error : "+XmlHttp.status);
}
}
};
XmlHttp.send(null);
}
}
function chgMooname(e, defa_v) {
if ( e ) {
CreateXmlHttp();
XmlHttp.open("get", "ajax.chgmooname.php?MooID="+e+"&DfVal="+defa_v, true);
XmlHttp.onreadystatechange=function() {
if (XmlHttp.readyState==4) {
if (XmlHttp.status==200) {
var res = XmlHttp.responseText; //alert(res);
arrMoo = res.split(",");
document.getElementById("addr_moo").value= arrMoo[0];
document.getElementById("addr_village").value= arrMoo[1];
} else if (XmlHttp.status==404) {
alert("ไม่สามารถทำการดึงข้อมูลได้");
} else {
alert("Error : "+XmlHttp.status);
}
}
};
XmlHttp.send(null);
}
}
<? if ( $objMB->addr_province && $objMB->addr_amphur && $objMB->addr_tambon ) echo "chgAmphur('$objMB->addr_province', '$objMB->addr_amphur', '$objMB->addr_tambon');"; ?>
</SCRIPT>
<script language="JavaScript" type="text/javascript">
function isEmail(str) {
var at="@";
var dot=".";
var lat=str.indexOf(at); var lstr=str.length;
var ldot=str.indexOf(dot);
if ((str.indexOf(at)==-1) || (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
|| (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) || (str.indexOf(at,(lat+1))!=-1)
|| (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) || (str.indexOf(dot,(lat+2))==-1) ||
(str.indexOf(" ")!=-1)) {
return false;
}
return true;
}
function register_check()
{
if(document.register.public_amphur.value=="") {
alert("กรุณาเลือกอำเภอ") ;
document.register.public_amphur.focus() ;
return false ;
}
if(document.register.public_tambol.value=="") {
alert("กรุณาเลือกตำบลด้วย") ;
document.register.public_tambol.focus() ;
return false ;
}else if(isNaN(document.register.public_moo.value)==true) {
alert("กรุณากรอกหมู่ที่ ด้วยตัวเลขเท่านั้น") ;
document.register.public_moo.focus() ;
return false ;
}else if(isNaN(document.register.public_long.value)==true) {
alert("กรุณากรอกลองติจูด ด้วยตัวเลขเท่านั้น") ;
document.register.public_long.focus() ;
return false ;
}else if(isNaN(document.register.public_la.value)==true) {
alert("กรุณากรอกละติจูดด้วยตัวเลขเท่านั้น") ;
document.register.public_la.focus() ;
return false ;
}else if(document.register.type_problem.value=="") {
alert("กรุณาเลือกประเภทปัญหาด้วย") ;
document.register.type_problem.focus() ;
return false ;
}else if(document.register.complain_detail.value=="") {
alert("กรุณากรอกรายละเอียดปัญหา") ;
document.register.complain_detail.focus() ;
return false ;
}else if(document.register.type_level.value=="") {
alert("กรุณาเลือกระดับปัญหา") ;
document.register.type_level.focus() ;
return false ;
}
else if(document.register.nid.value=="") {
alert("กรุณาเลือกหน่วยงานที่ต้องดำเนินการแก้ไข") ;
document.register.nid.focus() ;
return false ;
}else{
return true ;
}
}
</script>
</HEAD>
<BODY >
<TABLE width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" style="filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#144C85', EndColorStr='#ffffff');">
<?
if($action == "Ticket_ID"){
$sql_Ticket = "SELECT * FROM tbl_complain WHERE complain_id ='$complain_id'";
$result_Ticket = mysql_db_query($dbname,$sql_Ticket);
$rs_t = mysql_fetch_assoc($result_Ticket);
?>
<TR align="center">
<TD valign="top" background="bimg/bg1.gif" style="background-repeat: no-repeat; background-position:right bottom ">
<TABLE width="99%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<TR>
<TD align="center" valign="top"><BR>
<BR></TD>
</TR>
</TABLE>
</TD>
</TR>
<?
}// end //if($Aaction == "Ticket_ID"){
?>
<TR>
<TD valign="top" background="bimg/bg1.gif" style="background-repeat: no-repeat; background-position:right bottom "><TABLE width="100%" border="0" cellpadding="0" cellspacing="0">
<TR><TD valign="top"></TD></TR>
<TR>
<TD valign="top" >
<?
if($action == "EDIT"){
if($action == "EDIT"){
$strSQL_edit = "SELECT * FROM tbl_complain WHERE complain_id = '$complain_id'";
//echo $strSQL_edit;
$Result_edit = mysql_db_query($dbname,$strSQL_edit);
$rse = mysql_fetch_array($Result_edit);
if($rse[act_start_date] != "0000-00-00"){
$arr_d1 = explode("-",$rse[act_start_date]);
if($arr_d1[0] > 0){
$txt_act_start_date = $arr_d1[2]."/".$arr_d1[1]."/".($arr_d1[0]+543);
}
}
if($rse[act_end_date] != "0000-00-00"){
$arr_d2 = explode("-",$rse[act_end_date]);
if($arr_d2[0] > 0){
$txt_act_end_date = $arr_d2[2]."/".$arr_d2[1]."/".($arr_d2[0]+543);
}
}
if($rse[accept_date] != "0000-00-00"){
$arr_d3 = explode("-",$rse[accept_date]);
if($arr_d3[0] > 0){
$txt_accept_date = $arr_d3[2]."/".$arr_d3[1]."/".($arr_d3[0]+543);
}
}
}
?>
<FORM action = "?p=form_edit_data.php" method ="post" enctype="multipart/form-data" name ="register" id="register" onSubmit="return register_check();">
<p>
<INPUT type="hidden" name="senttab" value="0">
</p>
<TABLE width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<TR>
<TD colspan="5" align="left" valign="top" bgcolor="#BDC9F9" class="link_back">ข้อมูลผู้กรอกความต้องการ</TD>
</TR>
<tr>
<td width="16%" bgcolor="#FFFFFF"><div align="right"><strong>วันที่ขอความช่วยเหลือ:</strong></div></td>
<td align="left" colspan="4" bgcolor="#FFFFFF">
<?php
$arrDate = explode("-",$rse['time_add']);
$TimeLineDate = $arrDate[2]."-".$arrDate['1']."-".($arrDate[0]+543);
?>
<input name="TimeLineDate" type="text" id="TimeLineDate" size="20" maxlength="10" onFocus="this.select();" onKeyPress="chkDateFormat(this.id, this.value);" onKeyUp="autoTab(this)" value="<? if($TimeLineDate == "--543"){ echo date("d-m-").(date("Y")+543);}else{ echo $TimeLineDate;}?>"/>
<img src="calendar/calendar2.gif" title="วัน-เดือน-ปี" width="20" height="20" border="0" align="absmiddle"
onclick="popUpCalendar(this, document.getElementById('TimeLineDate'), 'dd-mm-yyyy')" onMouseOver="this.style.cursor='pointer'"value="" /></td>
</tr>
<TR>
<TD align="right" valign="top" bgcolor="#FFFFFF" class="link_back">จังหวัด : </TD>
<TD colspan="4" align="left" bgcolor="#FFFFFF"><strong>
<label>
<?php
$province = mysql_query("SELECT ccDigi,ccName,ccType FROM ccaa WHERE ccType='Changwat' AND ccDigi LIKE '13000000' ");
while( $ram = mysql_fetch_array($province) ) {
$id=$ram['ccDigi'];
?>
<input type="readonly" name="public_province1" id="public_province1" value="ปทุมธานี" />
<input name="public_province" type="hidden" value="<? echo $ram['ccDigi'];?>" /><? } ?>
</label>
</strong></TD>
</TR><TR>
<TD align="right" valign="top" bgcolor="#FFFFFF" class="link_back">อำเภอ <span class="redlink">*</span>: </TD>
<TD colspan="4" align="left" bgcolor="#FFFFFF"><strong>
<select name="public_amphur" id="public_amphur" onChange="chgTambon(this.value, 13);">
<?php $slted= $rse['public_amphur'];
$am = mysql_query("SELECT ccDigi,ccName,ccType FROM ccaa WHERE ccType='Aumpur' AND ccDigi LIKE '13%' ");
while( $ram = mysql_fetch_array($am) ) {
if($ram['ccDigi']==$slted){ ?>
<option value="<?=$ram['ccDigi']?>"selected><?=$ram['ccName']?></option>;
<? }else{ ?>
<option value="<?=$ram['ccDigi']?>"><?=$ram['ccName']?></option>;
<?
}
}
?>
</select>
<LABEL id="lblAmphur"></LABEL>
</strong></TD>
<? } ?> </TR>
<TR>
<TD align="right" valign="top" bgcolor="#FFFFFF" class="link_back">ตำบล <span class="redlink">*</span>: </TD>
<TD colspan="4" align="left" bgcolor="#FFFFFF"><strong>
<LABEL id="lblTambon">
<select name="public_tambol" id="public_tambol" onChange="chgMoo(this.value,<?=$ramm['ccDigi']?>)";>
<?php $t_id = substr($_GET['TbID'],0,4);
$slted=$rse['public_tambol'];
$amm = mysql_query("SELECT ccDigi,ccName,ccType FROM ccaa_pathumthani WHERE ccType='Tamboon' AND ccDigi LIKE '$t_id%' ");
while( $ram = mysql_fetch_array($amm) ) {
if($ram['ccDigi']==$slted){ ?>
<option value="<?=$ram['ccDigi']?>"selected><?=$ram['ccName']?></option>;
<? }else{ ?>
<option value="<?=$ram['ccDigi']?>"><?=$ram['ccName']?></option>;
<?
}
}
?>
</select>
</LABEL>
</strong></TD>
</TR><TR>
<TD align="right" valign="top" bgcolor="#FFFFFF" class="link_back">หมู่ที่ :</TD>
<TD colspan="4" align="left" bgcolor="#FFFFFF">
<input name="public_moo" type="text" id="public_moo" size="2" maxlength="2" value="<?=$rse[public_moo];?>"> </TD>
</TR>
<TR>
<TD align="right" valign="top" bgcolor="#FFFFFF" class="link_back">พิกัดจุด X:</TD>
<TD width="9%" align="left" valign="top" bgcolor="#FFFFFF">
<div id="show_lat"><?=($_POST['lattitude']=='')?$rse['public_latitude']:$_POST['lattitude']?></div><input name="lattitude" id="lattitude" type="hidden" value="<?=($_POST['lattitude']=='')?$rse['public_latitude']:$_POST['lattitude']?>"> </TD>
<TD width="4%" valign="top" align="left" bgcolor="#FFFFFF"><span class="link_back">พิกัดจุด Y:</span><div id="show_lon"></div></TD>
<TD width="13%" valign="top" align="left" bgcolor="#FFFFFF"><div id="show_lon2">
<?=($_POST['public_longtitude']=='')?$rse['public_longtitude']:$_POST['longtitude']?>
</div>
<input name="longtitude" id="longtitude" type="hidden" value="<?=($_POST['public_longtitude']=='')?$rse['public_longtitude']:$_POST['longtitude']?>"></TD>
<TD width="20%" valign="top" align="left" bgcolor="#FFFFFF"><a href="#" onClick="javascript:window.open('map.php','show','toolbar=0,location=0,directories=0,status=0,menubar=0,height=530,width=1000,resizeable=1,scrollbars=1');"><img src="img/google_map_logo.png" align="absmiddle" border="0" /></a>
<a href="files/help_point_mapv2.pdf" target="_blank"><img src="../../images/help.png" align="absmiddle" border="0">วีธีการกำหนดจุดพิกัด</a></TD>
</TR>
<TD colspan="5" align="left" valign="middle" bgcolor="#BDC9F9" class="p_border"><STRONG>รายละเอียดเรื่องที่ต้องการ</STRONG></TD>
</TR>
<TR>
<TD align="right" valign="middle" bgcolor="#FFFFFF" class="link_back">ประเภทปัญหา <SPAN class="redlink">*</SPAN> : </TD>
<TD colspan="4" align="left" bgcolor="#FFFFFF"><select name="type_problem" id="type_problem" onChange="showoptionA(this);">
<option value="">- ระบุประเภทปัญหา -</option>
<?
$sql_type_problem = "SELECT * FROM tbl_type_request ORDER BY type_request ASC";
$Result_type_problem = mysql_db_query($dbname,$sql_type_problem);
while($rs_tp = mysql_fetch_assoc($Result_type_problem)){
if($rs_tp[request_id] == $rse[type_request]){ $sel = "selected";}else{ $sel = "";}
echo "<option value='$rs_tp[request_id]' $sel>$rs_tp[type_request]</option>";
}
?>
</select> </TD>
</TR>
<TR>
<TD align="right" valign="top" bgcolor="#FFFFFF" class="link_back">รายละเอียด<SPAN class="redlink">*</SPAN> : </TD>
<TD colspan="4" align="left" bgcolor="#FFFFFF"><LABEL>
<textarea name="complain_detail" cols="70" rows="5" id="complain_detail"><?=$rse[complain_detail]?></textarea>
</LABEL></TD>
</TR>
<TR>
<TD align="right" valign="middle" bgcolor="#FFFFFF"><strong>ระดับความต้องการ</strong><SPAN class="redlink">*</SPAN><SPAN class="link_back"> :</SPAN></TD>
<TD colspan="4" align="left" bgcolor="#FFFFFF">
<select name="type_level" id="type_level" >
<option value="" >- ระบุระดับความต้องการ -</option>
<option value="1" <?=($rse['request_level']=="1")?"selected='selected'":"";?>>ระดับความต้องการน้อย </option>
<option value="2" <?=($rse['request_level']=="2")?"selected='selected'":"";?>>ระดับความต้องการปานกลาง</option>
<option value="3" <?=($rse['request_level']=="3")?"selected='selected'":"";?>>ระดับความต้องการมาก </option>
</select></TD>
</TR>
<TR>
<TD align="right" valign="top" bgcolor="#FFFFFF"><strong>ไฟล์รูปภาพและเอกสาร</strong><SPAN class="redlink"></SPAN><SPAN class="link_back"> :</SPAN></TD>
<TD colspan="4" align="left" bgcolor="#FFFFFF"> <SPAN class="style3">หมายเหตุ : </SPAN>ไฟล์ที่ท่านสามารถแนบได้ เช่น ไฟล์รูป ที่มีนามสกุล jpg, jpeg, gif หรือไฟล์เอกสารทั่วไป เช่น word, excelและขนาด file ต้องไม่เกิน 2เมกาไบต์
<SPAN style="cursor:pointer;" onClick="addFile()">เพิ่มไฟล์แนบ <IMG src="../../images/profile_collapsed.gif" border="0"></SPAN>
<UL id="files-root">
</UL>
<?
$sql_act_file = "SELECT * FROM tbl_attachfile WHERE complain_id ='$complain_id'";
$result_act_file = mysql_db_query($dbname,$sql_act_file);
while($rs_act = mysql_fetch_assoc($result_act_file)){
if($view_type == "view"){
addlog("เปิดไฟล์แนบเรื่องร้องเรียน-ร้องทุกข์",$app_id,$act7,$complain_id); // add log
echo "<a href='$rs_act[act_file]' target='_blank'><img src=\"../../images/attach16.gif\" width=\"16\" height=\"16\" border=\"0\">$rs_act[note_file]</a><br>";
}else{
echo "<a href='$rs_act[act_file]' target='_blank'><img src=\"../../images/attach16.gif\" width=\"16\" height=\"16\" border=\"0\">$rs_act[note_file]</a><img src=\"../../images/delete.gif\" width=\"20\" height=\"18\" border=\"0\" onClick=\"return confirmDelete('form_edit_data.php?ActionF=DEL_FILE&id=$rs_act[runno]&complain_id=$complain_id')\" style=\"cursor:hand\" title='คลิ๊กเพื่อลบรายการไฟล์แนบ'><br>";
}
}
?> </TD>
</TR>
<TR>
<TD align="right" valign="middle" bgcolor="#FFFFFF"><strong>หน่วยงานที่ต้องดำเนินการแก้ไข<span class="redlink">*</span></strong><SPAN class="link_back">:</SPAN></TD>
<TD colspan="4" align="left" bgcolor="#FFFFFF">
<select name="nid" id="nid" onChange="showoptionA(this);">
<option value="">-เลือกหน่วยงาน -</option>
<?
$sql_type_problem = "SELECT * FROM pathumthani_integration.main_menu ORDER BY NID ASC";
$Result_type_problem = mysql_db_query($dbname,$sql_type_problem);
while($rs_tp = mysql_fetch_assoc($Result_type_problem)){
echo "<option value='$rs_tp[NID]' ".(($rs_tp['NID'] == $rse['nid'])?"SELECTED":"").">$rs_tp[NLABEL]</option>";
}
?>
</select> </TD>
</TR>
<TR>
<TD colspan="5" align="center" valign="top" bgcolor="#BDC9F9">
<INPUT type="hidden" name="insert_id" value="<?=$complain_id?>">
<INPUT type="hidden" name="Aaction" value="SAVE_EDIT">
<INPUT type="submit" name="Submit" value=" บันทึก " >
<INPUT type="reset" name="Submit2" value="ล้างข้อมูล">
<INPUT type="button" name="btnBK" value="ยกเลิก" onClick="location.href='index.php'"> </TD>
</TR>
</TABLE>
</FORM>
<?
}
?></TD>
</TR>
</TABLE></TD>
</TR>
</TABLE>
<?
echo "<!--USER INFO <br>";
echo $REMOTE_ADDR;
echo "<pre>";print_r($_SERVER['HTTP_USER_AGENT']); echo "</pre><br>-->";
?>
</BODY>
</HTML>
<?
//insert timeQuery
$time_end = getmicrotime();
writetime2db($timestart,$timeend);
//insert timeQuery
?>