|
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) ;
include_once("../../config/config_epm.inc.php");
include_once("manage_user.inc.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" />
<title><?=$title_name?></title>
<link href="common/style.css" rel=stylesheet>
<link href="../../styles/styles.css" type=text/css rel=stylesheet />
<script language='javascript' src='js/function.js'></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;
}
.style1 {color: #FF0000}
.style2 {font-size: 24px}
.h_menu {color:#FF9900}
-->
.bg_th{
background-image:url(images/horiz-bg.png);
background-repeat:repeat-x;
font-weight:bold;
color:#FFFFFF;
text-align:center;
}
</style>
<?
include("header.php");
?>
<br />
<p>
<?
if($_POST['Submit']){
//$letter_date = Save_date($_POST['letter_date']);
$strSQL_2 = "SELECT
Count(runid) AS chkCount,book_id,amphur,runid
FROM industry_durable
WHERE amphur='".$_POST['amphur']."' AND book_id='".$_POST['book_id']."'
GROUP BY runid
";
$rsConn_2 = mysql_db_query($dbname,$strSQL_2);
$Result_2 = mysql_fetch_assoc($rsConn_2);
$checkRepeat=0;
$strBookType='';
if($_POST['book_type']=='1'){
$strBookType=$_POST['book_type1'];
}else{
$strBookType=$_POST['book_type'];
}
if($_GET['edit']==''){
if($Result_2['chkCount'] < 1){
mysql_query("
INSERT INTO `industry_durable` SET
`code`='".$_POST['code']."',
`tambol`='".$_POST['tambol']."',
`amphur`='".$_POST['amphur']."',
`province`='".$_POST['province']."',
`book_type`='".$strBookType."',
`book_id`='".$_POST['book_id']."',
`plantation_unit`='".$_POST['plantation_unit']."',
`work_unit`='".$_POST['work_unit']."',
`wah_unit`='".$_POST['wah_unit']."',
`useful`='".$_POST['useful']."',
`status`='".$_POST['status']."',
`note`='".$_POST['note']."',
`gpsx`='".$_POST['lattitude']."',
`gpsy`='".$_POST['longtitude']."',
`update_time`=now()
");
//mysql_query("INSERT INTO industry_shop (name,class_name,note)VALUES('".$_POST['class_id']."','".$_POST['class_name']."','".$_POST['note']."')");
//mysql_query("INSERT INTO da_deprecrate (type_id,useful_life,deprecrate)VALUES('".$_POST['type_id']."','".$_POST['life_low']."','".$_POST['deprecrate_low']."')");
//mysql_query("INSERT INTO da_deprecrate (type_id,useful_life,deprecrate)VALUES('".$_POST['type_id']."','".$_POST['life_high']."','".$_POST['deprecrate_high']."')");
print"<script language='JavaScript'> alert('บันทึกข้อมูลเรียบร้อยแล้ว') </script> ";
print"<meta http-equiv=\"refresh\" content=\"0;URL=industry_durable.php\">\n";
exit();
}
else{
$checkRepeat = 1;
}
}
else{
//echo $Result_2['type_id'];
if($Result_2['chkCount'] < 1 || $_GET['runid']==$Result_2['runid']){
mysql_query("
UPDATE `industry_durable` SET
`code`='".$_POST['code']."',
`tambol`='".$_POST['tambol']."',
`amphur`='".$_POST['amphur']."',
`province`='".$_POST['province']."',
`book_type`='".$strBookType."',
`book_id`='".$_POST['book_id']."',
`plantation_unit`='".$_POST['plantation_unit']."',
`work_unit`='".$_POST['work_unit']."',
`wah_unit`='".$_POST['wah_unit']."',
`useful`='".$_POST['useful']."',
`status`='".$_POST['status']."',
`note`='".$_POST['note']."',
`gpsx`='".$_POST['lattitude']."',
`gpsy`='".$_POST['longtitude']."',
`update_time`=now()
WHERE runid='".$_GET['runid']."'
");
/*mysql_query("UPDATE industry_class
SET class_id='".$_POST['class_id']."', class_name='".$_POST['class_name']."',note='".$_POST['note']."'
WHERE runid='".$_GET['runid']."' "); */
print"<script language='JavaScript'> alert('บันทึกข้อมูลเรียบร้อยแล้ว') </script> ";
print"<meta http-equiv=\"refresh\" content=\"0;URL=industry_durable.php\">\n";
exit();
}
else{
$checkRepeat = 1;
}
}
}
?>
<img src="images/unpublish_f2.png" width="30" height="30" border="0" align="absmiddle" /><strong style="color:#000033; font-size:18px;">
<?
if($_GET['edit']==''){
echo "แบบฟอร์มเพิ่มข้อมูลที่ราชพัสดุ";
}
else{
echo "แบบฟอร์มแก้ไขข้อมูลที่ราชพัสดุ";
}
?></strong>
</p>
<script language="JavaScript" type="text/javascript">
function CheckForm ( form ) {
if ( form.book_id.value == "" ) {
alert("กรุณาป้อน หมายเลขของหนังสือสำคัญสำหรับที่ดิน");
form.book_id.focus();
return false;
}else if(document.getElementById('txt_plantation_unit').innerHTML != ""){
alert(" ! กรุณาระบุ เนื้อที่ (ไร่) ให้ถูกต้อง");
document.getElementById('txt_plantation_unit').focus();
return false;
}else if(document.getElementById('txt_work_unit').innerHTML != ""){
alert(" ! กรุณาระบุ เนื้อที่ (งาน) ให้ถูกต้อง");
document.getElementById('txt_work_unit').focus();
return false;
}else if(document.getElementById('txt_wah_unit').innerHTML != ""){
alert(" ! กรุณาระบุ เนื้อที่ (วา) ให้ถูกต้อง");
document.getElementById('txt_wah_unit').focus();
return false;
}
return true;
}
function Inint_AJAX() {
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {} //IE
try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} //IE
try { return new XMLHttpRequest(); } catch(e) {} //Native Javascript
alert("XMLHttpRequest not supported");
return null;
}
function chkAmphur(e) {
//alert(e.id);
var req = Inint_AJAX();
var sec = document.getElementById(e.id).options[document.getElementById(e.id).options.selectedIndex].value;
req.onreadystatechange = function () {
if (req.readyState==4) {
if (req.status==200) {
//alert(req.responseText);
document.getElementById('AmphurCHK').innerHTML=req.responseText; //รับค่ากลับมา
}
}
};
req.open("GET", "ajax_chkAmphur.php?varChk="+sec); //สร้าง connection
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=tis-620"); // set Header
req.send(null); //ส่งค่า
}
function chkTambol(e) {
//alert(e.id);
var req = Inint_AJAX();
var sec = document.getElementById(e.id).options[document.getElementById(e.id).options.selectedIndex].value;
req.onreadystatechange = function () {
if (req.readyState==4) {
if (req.status==200) {
//alert(req.responseText);
document.getElementById('TambolCHK').innerHTML=req.responseText; //รับค่ากลับมา
}
}
};
req.open("GET", "ajax_chkTambol.php?varChk="+sec+"&chk=1"); //สร้าง connection
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=tis-620"); // set Header
req.send(null); //ส่งค่า
}
function google(){
if(document.getElementById('show_lon').innerHTML==''){
window.open('map.php','show','toolbar=0,location=0,directories=0,status=0,menubar=0,height=530,width=1000,resizeable=1,scrollbars=1');
}else{
window.open('map_edit.php?longitude='+document.getElementById('show_lon').innerHTML+'&latitude='+document.getElementById('show_lat').innerHTML,'show','toolbar=0,location=0,directories=0,status=0,menubar=0,height=530,width=1000,resizeable=1,scrollbars=1');
}
}
function showBookType(e){
//alert('test');
if( e.value == "1" ){
document.getElementById('show_book_type').style.display = "block";
//document.getElementById( "IM_"+my_id ).src = "images/profile_expanded.gif";
//document.getElementById( "IM_"+my_id ).title = "ซ่อนเขตพื้นที่";
}else{
document.getElementById('show_book_type').style.display = "none";
//document.getElementById( "IM_"+my_id ).src = "images/profile_plus.gif";
//document.getElementById( "IM_"+my_id ).title = "แสดงเขตพื้นที่";
}
}
</script>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#B4B4B4">
<table width="100%" border="0" cellpadding="5" cellspacing="1">
<tr>
<td bgcolor="#FFFFFF" align="center">
<form id="form1" name="form1" method="post" action="" onsubmit="return CheckForm(this)">
<table width="100%" border="0">
<tr>
<td width="23%"> </td>
<td width="67%" class="style1">
<?
if($checkRepeat == 1){
echo "*** หมายเลขของหนังสือสำคัญสำหรับที่ดินซ้ำ กรุณาตรวจสอบ";
}
?>
</td>
<td width="10%"> </td>
</tr>
<?
if($_GET['edit']!=''){
$strSQL_3 = "SELECT * FROM industry_durable
";
if($_GET['runid'] != ''){
$strSQL_3 .= " WHERE runid= '".$_GET['runid']."'
";
}
$rsConn_3 = mysql_db_query($dbname,$strSQL_3);
$Result_3 = mysql_fetch_assoc($rsConn_3);
}
/*else{
$strSQL_class = "SELECT COUNT(runid) AS NUMCLASS FROM industry_class ";
$rsConn_class = mysql_db_query($dbname,$strSQL_class);
$Result_class = mysql_fetch_assoc($rsConn_class);
$class_id_number1=$Result_class['NUMCLASS']+1;
function chkSame_1($number1){
global $dbname,$class_id_number;
$strP1 = "SELECT COUNT(runid) as chkNUM
FROM industry_class
WHERE class_id='".$number1."'
";
$rsP1 = mysql_db_query($dbname,$strP1);
$Result_P1 = mysql_fetch_assoc($rsP1);
if($Result_P1['chkNUM']<1){
$class_id_number=$number1;
}else{
$strNumber=(($number1*1)+1);
chkSame_1($strNumber);
}
}
chkSame_1($class_id_number1);
}*/
//echo str_replace ( "ManUTD", "UTD", "City" );
?>
<tr>
<td height="25" align="right"><span class="style1">*</span> หมายเลขหนังสือสำคัญสำหรับที่ดิน</td>
<td align="left"><input name="book_id" type="text" id="book_id" size="23" value="<?=($_POST['book_id']=='')?$Result_3['book_id']:$_POST['book_id']?>" />
</td>
<td> </td>
</tr>
<tr>
<td height="25" align="right"> ประเภทหนังสือสำคัญสำหรับที่ดิน</td>
<td align="left">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="19%">
<select name="book_type" id="book_type" style="width:150px" onchange="showBookType(this);">
<option value="โฉนด" <?=($_GET['edit']!='')?(($Result_3['book_type']=='โฉนด')?"selected":''):''?>>โฉนด</option>
<option value="เช่า" <?=($_GET['edit']!='')?(($Result_3['book_type']=='เช่า')?"selected":''):''?>>เช่า</option>
<option value="1" <?=($_GET['edit']!='')?(($Result_3['book_type']!='โฉนด' && $Result_3['book_type']!='เช่า')?"selected":''):''?>>อื่นๆ</option>
</select>
</td>
<td width="81%">
<span id="show_book_type" style="display:<?=($_GET['edit']=='')?'none':(($Result_3['book_type']!='โฉนด' && $Result_3['book_type']!='เช่า')?'':'none')?>">รายละเอียด <input name="book_type1" type="text" id="book_type1" size="40" value="<?=($_POST['book_type1']=='')?$Result_3['book_type']:$_POST['book_type1']?>" /></span>
</td>
</tr>
</table>
</td>
<td> </td>
</tr>
<tr>
<td height="25" align="right"> หมายเลขทะเบียน</td>
<td align="left"><input name="code" type="text" id="code" size="23" value="<?=($_POST['code']=='')?$Result_3['code']:$_POST['code']?>" />
</td>
<td> </td>
</tr>
<tr>
<td height="25" align="right"> จังหวัด</td>
<td align="left">
<select name="province" id="province" disabled="disabled" onChange="chkAmphur(this);" style="width:150px">
<!--<option value="">เลือกจังหวัด</option>-->
<?php
//$am = mysql_query("SELECT ccDigi,ccName,ccType FROM ccaa WHERE ccType='Changwat' AND ccName NOT LIKE('%*%') ORDER By ccName ");
$am = mysql_query("SELECT ccDigi,ccName,ccType FROM ccaa WHERE ccType='Changwat' AND ccDigi='13000000' ");
while( $ram = mysql_fetch_array($am) ) {
?>
<option value="<?=$ram['ccDigi']?>" <? if($Result_3['province']==$ram['ccDigi']){ echo "selected"; } ?>>
<?=$ram['ccName']?>
<input name="province" type="hidden" id="province" size="48" value="<?=($_GET['edit'])?($_POST['province']=='')?$Result_3['province']:$_POST['province']:$ram['ccDigi']?>" />
<?
//echo "<option value=\"".$ram['ccDigi']."\" $slted>".$ram['ccName']."</option>\n";
}
?>
</select>
</td>
<td> </td>
</tr>
<tr>
<td height="25" align="right"> อำเภอ</td>
<td align="left">
<span id="AmphurCHK">
<select name="amphur" id="amphur" <?=($_GET['view']=='1')?'disabled="disabled"':''?> onChange="chkTambol(this);" style="width:150px">
<option value="">เลือกอำเภอ</option>
<?
// if($_GET['edit']){
$am1 = mysql_query("SELECT ccDigi,ccName,ccType FROM ccaa WHERE ccaa.ccType = 'Aumpur' AND ccaa.ccDigi LIKE '13%' ");
while( $ram1 = mysql_fetch_array($am1) ) {
?>
<option value="<?=$ram1['ccDigi']?>" <? if($Result_3['amphur']==$ram1['ccDigi']){ echo "selected"; } ?>>
<?=$ram1['ccName']?>
<?
//echo "<option value=\"".$ram1['ccDigi']."\" $slted>".$ram1['ccName']."</option>\n";
}
// }
?>
</select>
</span>
</td>
<td> </td>
</tr>
<tr>
<td height="25" align="right"> ตำบล</td>
<td align="left">
<span id="TambolCHK">
<select name="tambol" id="tambol" <?=($_GET['view']=='1')?'disabled="disabled"':''?> style="width:150px">
<option value="">เลือกตำบล</option>
<?
if($_GET['edit']){
$am = mysql_query("SELECT ccDigi,ccName,ccType FROM ccaa WHERE ccType='Tamboon' AND ccName NOT LIKE('%*%') AND ccaa.ccDigi LIKE '13%' ORDER By ccName ");
while( $ram = mysql_fetch_array($am) ) {
?>
<option value="<?=$ram['ccDigi']?>" <? if($Result_3['tambol']==$ram['ccDigi']){ echo "selected"; } ?>>
<?=$ram['ccName']?>
<?
//echo "<option value=\"".$ram['ccDigi']."\" $slted>".$ram['ccName']."</option>\n";
} }
?>
</select>
</span>
</td>
<td> </td>
</tr>
<tr>
<td height="25" align="right"> เนื้อที่ (ไร่)</td>
<td align="left"><input name="plantation_unit" type="text" id="plantation_unit" size="23" value="<?=($_POST['plantation_unit']=='')?$Result_3['plantation_unit']:$_POST['plantation_unit']?>" onblur="return checkNumber(this,document.getElementById('txt_plantation_unit'));"/><span id="txt_plantation_unit"></span>
</td>
<td> </td>
</tr>
<tr>
<td height="25" align="right"> เนื้อที่ (งาน)</td>
<td align="left"><input name="work_unit" type="text" id="work_unit" size="23" value="<?=($_POST['work_unit']=='')?$Result_3['work_unit']:$_POST['work_unit']?>" onblur="return checkNumber(this,document.getElementById('txt_work_unit'));"/><span id="txt_work_unit"></span>
</td>
<td> </td>
</tr>
<tr>
<td height="25" align="right"> เนื้อที่ (วา)</td>
<td align="left"><input name="wah_unit" type="text" id="wah_unit" size="23" value="<?=($_POST['wah_unit']=='')?$Result_3['wah_unit']:$_POST['wah_unit']?>" onblur="return checkNumber(this,document.getElementById('txt_wah_unit'));"/><span id="txt_wah_unit"></span>
</td>
<td> </td>
</tr>
<tr>
<td height="25" align="right"> การใช้ประโยชน์</td>
<td align="left"><textarea name="useful" id="useful" <?=($_GET['view']=='1')?'disabled="disabled"':''?> cols="40" rows="3"><?=($_POST['useful']=='')?$Result_3['useful']:$_POST['useful']?></textarea>
</td>
<td> </td>
</tr>
<tr>
<td height="25" align="right"> สภาพ</td>
<td align="left">
<select name="status" id="status" style="width:150px">
<option value="1" <? if($Result_3['status']=='1'){ echo "selected"; } ?>>ดี</option>
<option value="2" <? if($Result_3['status']=='2'){ echo "selected"; } ?>>ชำรุด</option>
<option value="3" <? if($Result_3['status']=='3'){ echo "selected"; } ?>>สูญหาย</option>
</select>
</td>
<td> </td>
</tr>
<tr>
<td height="25" align="right"> หมายเหตุ</td>
<td align="left"><textarea name="note" id="note" <?=($_GET['view']=='1')?'disabled="disabled"':''?> cols="40" rows="2"><?=($_POST['note']=='')?$Result_3['note']:$_POST['note']?></textarea>
</td>
<td> </td>
</tr>
<tr>
<td height="25" align="right"> จุดพิกัดแกน(x):</td>
<td align="left"><div id="show_lat"><?=($_POST['lattitude']=='')?$Result_3['gpsx']:$_POST['lattitude']?></div><input name="lattitude" id="lattitude" type="hidden" value="<?=($_POST['lattitude']=='')?$Result_3['gpsx']:$_POST['lattitude']?>">
</td>
<td> </td>
</tr>
<tr>
<td height="25" align="right"> จุดพิกัดแกน(y):</td>
<td align="left"><div id="show_lon"><?=($_POST['longtitude']=='')?$Result_3['gpsy']:$_POST['longtitude']?></div><input name="longtitude" id="longtitude" type="hidden" value="<?=($_POST['longtitude']=='')?$Result_3['gpsy']:$_POST['longtitude']?>">
</td>
<td> </td>
</tr>
<tr>
<td height="25" align="right"></td>
<td align="left"><a href="#" onclick="google();"><img src="img/google_map_logo.png" align="absmiddle" border="0" /></a>
</td>
<td> </td>
</tr>
<tr>
<td height="25" align="right"> </td>
<td>
</td>
<td> </td>
</tr>
<tr>
<td align="right"> </td>
<td>
<input type="submit" name="Submit" value="บันทึก" />
<input type="reset" name="Submit2" value="ยกเลิก" />
<input type="button" name="back_main" value="ย้อนกลับ" onclick="history.back();"/>
</td>
<td> </td>
</tr>
</table>
</form>
</td></tr></table></td></tr></table>
<br />