|
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/eoffice/application/document/ |
Upload File : |
<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;
}
function showEle(divname){
if(document.getElementById(divname).style.display == 'none'){
document.getElementById(divname).style.display = 'block';
} else {
document.getElementById(divname).style.display = 'none';
}
}
function checkEle(divname){
//alert(document.post.minister.checked);
if(document.post.minister.checked==true){
document.getElementById(divname).style.display = 'block';
}else
{
document.getElementById(divname).style.display = 'none';
}
}
function openEle(divname){
document.getElementById(divname).style.display = 'block';
}
function closeEle(divname){
document.getElementById(divname).style.display = 'none';
}
// function check form
function checkForm(){
var check_xt = document.getElementById( "type" ).value;
//alert(check_xt);
// end กรณีเลือกหนังสือรับ
if(check_xt == "get"){
if(document.post.refid.value == ""){
alert("! กรุณาระบุเลขที่หนังสือด้วยครับ");
document.post.refid.focus();
return false;
}
if(document.post.pdate.value == ""){
alert("! กรุณาระบุวันที่ด้วยครับ");
document.post.pdate.focus();
return false;
}
if(document.post.sending.value == ""){
alert("! กรุณาระบุต้นทางของเอกสาร(จาก)");
document.post.sending.focus();
return false;
}
if(document.post.getting.value == ""){
alert("! กรุณาระบุต้นทางของเอกสาร(ถึง)");
document.post.getting.focus();
return false;
}
if(document.post.title.value == ""){
alert("! กรุณาชื่อเรื่อง");
document.post.title.focus();
return false;
}
}// end กรณีเลือกหนังสือรับ
// end กรณีเลือกหนังสือส่ง
if(check_xt == "send"){
if(document.post.getting.value == ""){
alert("! กรุณาระบุต้นทางของเอกสาร(ถึง)");
document.post.getting.focus();
return false;
}
if(document.post.sending_select[1].checked == true){
if(document.post.sid_show1.value == ""){
alert("! กรุณาผู้ลงนาม");
document.post.sid_select1.focus();
return false;
}
}
if(document.post.title.value == ""){
alert("! กรุณาชื่อเรื่อง");
document.post.title.focus();
return false;
}
}// end กรณีเลือกหนังสือส่ง
// end กรณีเลือกหนังสือเวียน
if(check_xt == "circular"){
if(document.post.sending_select[1].checked == true){
if(document.post.sid_show1.value == ""){
alert("! กรุณาผู้ลงนาม");
document.post.sid_select1.focus();
return false;
}
}
if(document.post.gid_show.value == ""){
alert("! กรุณาผู้รับหนังสือราชการ");
document.post.Button222.focus();
return false;
}
// end กรณีเลือกหนังสือเวียน
if(document.post.title.value == ""){
alert("! กรุณาชื่อเรื่อง");
document.post.title.focus();
return false;
}
}
// // end กรณีเลือกหนังสือเวียน
// if(check_xt == "send"){
// if(document.post.gid_show.value == ""){
// alert("! กรุณาระบุต้นทางของเอกสาร(จาก)");
// document.post.sid_select.focus();
// return false;
// }
// }// end กรณีเลือกหนังสือเวียน
if(document.post.getting.value == ""){
alert("! กรุณาระบปลายทางของเอกสาร(ถึง)")
document.post.getting.focus();
return false;
}else if(document.post.title.value == ""){
alert("! กรุณาระบุเรื่องของเอกสาร");
document.post.title.focus();
return false;
}else{
return true;
}
}
// end function check form
</script>
<style type="text/css">
<!--
.style1 {
color: #FF0000;
font-weight: bold;
}
.style2 {color: #CCCCCC}
-->
</style>
<FORM action="<?=$PHP_SELF?>?type=<?=$type?>" name="post" method="post" enctype="multipart/form-data" onSubmit="return checkForm();">
<? if( ($action=="edit") &&($id)){
$sql_doc_list="SELECT * FROM document WHERE id='$id' Limit 1";
$query = mysql_query($sql_doc_list)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$rs_doc=mysql_fetch_assoc($query);
$sql_getting_list="SELECT * FROM doc_receive WHERE docid='$rs_doc[id]' ";
$query = mysql_query($sql_getting_list)or die("Query line " . __LINE__ . " error<hr>".mysql_error()); $j=0;
$rsl=mysql_fetch_assoc($query);
$sql_attach_list="SELECT * FROM doc_receive WHERE docid='$rs_doc[id]' ";
$query = mysql_query($sql_attach_list)or die("Query line " . __LINE__ . " error<hr>".mysql_error()); $j=0;
while($rsa=mysql_fetch_assoc($query)){
$attachment[$rsa[attach]]=$rsa[name];
}
}
$sql_attach_check = "
SELECT
doc_attach.id,
doc_attach.name,
doc_attach.attach,
doc_attach.description
FROM
doc_attach
Inner Join document ON doc_attach.docid = document.id
WHERE
document.id = '$rs_doc[id]'
";
$result_check = mysql_query($sql_attach_check)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($crs = mysql_fetch_assoc($result_check)){
$attachname[$crs[id]]=$crs[name];
$attachfile[$crs[id]]=$crs[attach];
$descritment[$crs[id]]=$crs[description];
}
?>
<TABLE width="720" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#eeeeee">
<TR>
<TD>
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0" class="normal_black">
<TR bgcolor="#f8f8f8">
<TD height="20" colspan="2" class="normal_blue">
<IMG src="../../images/ico_keyin.gif" width="16" height="16" border="0" align="absmiddle">บันทึกข้อมูลทะเบียนหนังสือ<? if($type=="get"){echo "รับ";}else if($type=="send"){echo "ส่ง"; }else if($type=="circular"){echo "เวียน"; }?></TD>
</TR>
<!--<TR>
<TD colspan="2" height="20"><HR color="#f8f8f8"></TD>
</TR>-->
<TR>
<TD height="20" align="right">ลำดับเอกสาร <B>:</B> </TD>
<TD width="449">
<?
/*
$sql_max_case="select max(docid) as maxcase from document where type='$type' ";
$query_max = mysql_query($sql_max_case)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$maxrs = mysql_fetch_assoc($query_max);
if($rs_doc[docid]){$doc_gen=$rs_doc[docid];}else{ $doc_gen=$maxrs[maxcase]+1;}
*/
$sql_setting="
select * from system
";
$result=mysql_query($sql_setting);
while($rs=mysql_fetch_assoc($result)){
$com[$rs[command]]=$rs[value];
}
################################################# การออกเลขหนังสือส่ง
if( ($type=="send") || ($type=="circular") || ($type=="get")){
foreach($session_gid as $vid => $val){
foreach($val as $v1 => $v2){
$gid_checks=$v2;
}
}
$sql_setting="
select * from system
";
$result=mysql_query($sql_setting);
while($rs=mysql_fetch_assoc($result)){
$com[$rs[command]]=$rs[value];
}
if($com[outreset]=="year"){
$code_year_reset=" AND YEAR(document.time_rec)=YEAR(now( )) ";
}
if($type=="send"){$type_running="runningout";}
elseif($type=="circular"){$type_running="runningcircular";}
elseif($type=="get"){$type_running="runningin";}
/*
if($com[$type_running]>$num_gen){
$num_gen=$com[$type_running]+1;
}
*/
########################################################################################
$phpsessid=session_id( );
$time_past=60*35;
if($com[$type_running])
{
$code_cross=" AND number > $com[$type_running]";
}
$sql_del_old_request="
DELETE FROM document where type='$type' AND sending is NULL AND getting is NULL AND `time_rec` < DATE_SUB(NOW(),INTERVAL 30 MINUTE);
";
$query_max = mysql_query($sql_del_old_request)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$sql_del_old_owner_request="
DELETE FROM document where type='$type' AND sending is NULL AND getting is NULL AND owner = $session_staffid AND phpsessid='$phpsessid'
";
$query_max = mysql_query($sql_del_old_owner_request)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
if($com[outreset]=="year"){
$code_year_reset=" AND YEAR(document.time_rec)=YEAR(now( )) ";
}
$sql_max_case="select max(number) as maxnumber from document where type='$type' $code_year_reset AND number is not NULL $code_cross";
$query_max = mysql_query($sql_max_case)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$maxrs = mysql_fetch_assoc($query_max);
$sql_max_case="select COUNT(*) as rownumber from document where type='$type' $code_year_reset AND number is not NULL $code_cross";
$query_max = mysql_query($sql_max_case)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$rowrs = mysql_fetch_assoc($query_max);
if($type=="send"){$type_running="runningout";}
elseif($type=="circular"){$type_running="runningcircular";}
elseif($type=="get"){$type_running="runningin";}
$max_id=$maxrs[maxnumber]+1;
$now_id=$maxrs[maxnumber];
$max_row=$rowrs[rownumber];
$dif_row=$maxrs[maxnumber]-$rowrs[rownumber];
//echo "$maxrs[maxnumber] - $rowrs[rownumber] = ".$dif_row."<br><br>";
if($dif_row>0){$dif_row-=$com[$type_running];}
if($dif_row <= 0){
$num_gen=$max_id;
}elseif($dif_row > 0){
$x=$dif_row;
for($i=$now_id;$i>0;$i--){
$select_hole="
select * from document where number=$i AND type='$type' $code_year_reset $code_cross
";
$query_max = mysql_query($select_hole)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$num_row = mysql_num_rows($query_max);
// echo "$i หาเจอ $num_row<br>";
if($num_row==0){
$hole_take[$i]=$i;
// echo $i."<br>";
$x--;
if($x==0){
$num_gen=$i;
break;
}
}
}
}
$today_code="MONTH(time_rec) = MONTH( NOW()) AND DAY(time_rec) = DAY(NOW()) AND YEAR(time_rec) = YEAR(NOW())";
$sql_today="select * from document where $today_code and doc_status='w' and type='$type' order by docid DESC";
$rs_today_check=mysql_query($sql_today);
while($trs=mysql_fetch_assoc($rs_today_check)){
$num_gen=$trs[docid];
$id=$trs[id];
}
if($com[$type_running]>$num_gen){
$num_gen=$com[$type_running]+1;
}
//ตรวจสอบ max ID
$sql_max_case="select max(docid) as maxcase from document where type='$type' ";
$query = mysql_query($sql_max_case)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$maxrs = mysql_fetch_assoc($query);
if(!$maxrs){$maxcase="0";}else{$maxcase=$maxrs[maxcase];}$maxcase++;
//ตรวจสอบ ID ที่คีย์เข้ามา docregid KEY IN
$sql_max_case="select * from document where docid='$num_gen' and type='$type' AND doc_status!='w' ";
$query = mysql_query($sql_max_case)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$check_id = mysql_fetch_assoc($query);
if($check_id){
$num_gen=$maxcase;
}
###################### CHECK NUM AT LAST After REAL USING
$sql_check_num_at_last_step="select * from document where type='$type' and number='$num_gen' ";
$result_check=mysql_query($sql_check_num_at_last_step);
if($result_check){
$num_check=mysql_num_rows($result_check);
if($num_check>0){
$sql_log_increment="
INSERT INTO `log_increment_duplicat`
(`log_id`,`document_type`,`document_increment`,`user_id`,`username`,`phpsessionid`,`updatetime`)
VALUES
(NULL,'$type','$num_gen','$session_staffid','$session_username','$phpsessid',now( ))
";
@mysql_query($sql_log_increment);
echo " ขออภัยเกิดความผิดพลาด ในการสร้างเลขหนังสือ <br>";
echo " ERROR : N.$num_gen-$session_staffid to log_duplicate <br>";
echo " กรุณาแจ้ง call CENTER ที่หมายเลขโทรศัพท์ 08-0791-3940 , 08-0791-3941, 08-1961-2146 , 08-1961-2147 <br>";
echo " ขอบคุณค่ะ <br>";
die;
DIE;
}
}
############################
if(!$id){
$num_gen = getAuto_number($num_gen);
$sqldocreg = "
INSERT INTO document
(`id`,`docid`,`type`,`number`,`owner`,`time_rec`,`phpsessid`,`speed`,`secret` ,`pdate` )
VALUES
(NULL,'$num_gen','$type','$num_gen','$session_staffid','$sql_time','$phpsessid','0','0',now())
";
$query = mysql_query($sqldocreg)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$id=mysql_insert_id();
}else{
$sqldocreg = "
UPDATE document
SET
document.doc_status=NULL
WHERE
document.`id` ='$id'
LIMIT 1 ;
";
$query = mysql_query($sqldocreg)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
}
########################################################################################
?>
<INPUT name="docid" type="hidden" class="input" id="docid" style="width:120px;" value="<?=$num_gen?>" /><?=$num_gen?> </TD>
</TR>
<? if($type=="get"){?>
<TR valign="top">
<TD height="20" align="right">วันรับเอกสาร <b>:</b> </TD>
<TD><? if($rs_doc[tdate] == "")
{ $ndate = date("d/m/").(date("Y") + 543);
}else{
$d = explode("-", $rs_doc[tdate]);
$ndate = $d[2]."/".$d[1]."/".($d[0] + 543);
}
?>
<input type="text" name="tdate" id="tdate" class="input" maxlength="10" style="width:120px;" value="<?=$ndate?>" readonly="readonly" />
<? if ( ($type=="get") ) { ?>
<script language='JavaScript' type="text/javascript"> if (!document.layers) { document.write("<input type=button onclick='popUpCalendar(this, post.tdate, \"dd/mm/yyyy\")' value=' เลือกวัน ' class='input'>") }</script>
<? }?></TD>
</TR>
<? }?>
<TR>
<TD height="20" align="right"><span class="style1">*</span> ที่ <B>:</B> </TD>
<TD width="449">
<?
if((!$action)||($action=="add")){
// echo"<pre>";print_r($_SESSION);
// Code ชั่วคราว ก่อนการ ปรับให้สามารถ select GROUP เข้าใช้งานที่แน่นอนได้
if($type=="get"){
?>
<input name='refid' type='text' class="input" style="width:180px;" value="<?=$rs_doc[getting]?>" >
<?
}
if($type=="send"){$ref_digit="ref_digit";}else{$ref_digit="ref_digit_circular";}
$select_tag="";
$refid="";
$sql="
SELECT
$ref_digit.id,
$ref_digit.digit,
$ref_digit.value,
$ref_digit.`type`,
$ref_digit.gid,
ref_type.`key` AS `key`,
ref_type.`type` AS `name`
FROM
$ref_digit
Inner Join ref_type ON ref_type.id = $ref_digit.`type`
where gid=$gid_checks
order by $ref_digit.digit
";
$rst=mysql_query($sql);$i=0;
$row_rst=mysql_num_rows($rst);
if($row_rst){
while($var=mysql_fetch_assoc($rst)){$i++;
// echo "หลักที่ $i ประเภท $var[name] ";
if($var[key]=='cons'){
// echo "<input name=digit[$var[digit]] type=hidden value='$var[value]' maxlength=10 style='width:60px;' >$var[value]";
#echo "$var[value]";
$refid.=$var[value];
}else{
$show_var=$var[key];
if($var[key]=='autonumber')
{
$zerofill=$var[value];
if(!$zerofill){$zerofill="4";}
$hide_var="autonumber";
$show_var=zerofill($num_gen,$zerofill);
// echo "<input name='digit_char[$var[digit]]' type='hidden' value='$zerofill' >";
echo "<input name='autonumber' type='hidden' value='$num_gen' >";
}
if($var[key]=='yy'){$hide_var=date(y);$show_var=date(y);}
if($var[key]=='yyyy'){$hide_var=date(Y);$show_var=date(Y);}
if($var[key]=='ปป'){$hide_var=date(y)+43;$show_var=date(y)+43;}
if($var[key]=='ปปปป'){$hide_var=date(Y)+543;$show_var=date(Y)+543;}
// echo "<input name='digit[$var[digit]]' type='hidden' value='$hide_var' >$show_var";
#echo "$show_var";
$refid.=$show_var;
}
// echo "<br>";
}
}
if(($type=="send")||($type=="circular")){
?>
<? if($refid){ $d=explode("/",$refid);}?>
<input type='text' id='refid' name='refid' value='<?= $d[0]?>' >
<span class="style2">/<?if($type=="circular"){echo"ว";}?><?=$num_gen?>
<!--คุณได้รับเลขทะเบียนลำดับที่ <?=$num_gen?> สำหรับทะเบียนหนังสือฉบับนี้ --> </span>
<!--<input type='hidden' id='id' name='refid' value='<?=$id?>'>-->
<?
}
}
}
################################################# การออกเลขหนังสือ
if($action=="edit"){
echo $rs_doc[refid];
}
?> </TD>
</TR>
<TR>
<TD height="20" align="right">ลง ณ วันที่ <B>:</B> </TD>
<TD width="449">
<? if($rs_doc[pdate] == "")
{ $ndate = date("d/m/").(date("Y") + 543);
}else{
$d = explode("-", $rs_doc[pdate]);
$ndate = $d[2]."/".$d[1]."/".($d[0] + 543);
}
?>
<INPUT type="text" name="pdate" id="Txt-Field" class="input" maxlength="10" style="width:120px;" value="<?=$ndate?>" readonly>
<? if ( ($type=="get") ) { ?>
<SCRIPT language='javascript'> if (!document.layers) { document.write("<input type=button onclick='popUpCalendar(this, post.pdate, \"dd/mm/yyyy\")' value=' เลือกวัน ' class='input'>") }</SCRIPT>
<? }?> </TD>
</TR>
<TR valign="top">
<TD height="20" align="right"><span class="style1">*</span> จาก <B>:</B> </TD>
<TD align="left">
<? if($type=="get"){?>
<INPUT type="text" name="sending" id="sending" class="input" style="width:180px;" value="<?=$rs_doc[sending]?>">
<? }else if(($type=="send")||($type=="circular")){?>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><script language="JavaScript" type="text/javascript">
function enabledclass(){
alert(document.post.sending_select.);
}
</script>
<table border="0" cellspacing="0" cellpadding="0">
<?
for($i=0;$i<count($wordingset);$i++){
if($bgcolor == "#ffffff"){$bgcolor="#F5F5F5";}else{$bgcolor="#ffffff";}
?>
<tr bgcolor="<?=$bgcolor?>">
<td><?
if(is_array($wordingset[$i])){
for($j=0;$j<count($wordingset[$i]);$j++){
if(intval($i)>0){$disabled="disabled";}else{$disabled="";}
$disabled="";
$select1=explode('.',$rs_doc[sector]);
if($i==intval($select1[0])){
if($select1[1]!=""){
if($j==intval($select1[1])){
$checkedzero="checked";
}else{ $checkedzero=""; }
}else{ $checkedzero="checked"; }
}else{ $checkedzero=""; }
?>
</td>
</tr>
<tr bgcolor="<?=$bgcolor?>">
<td>
<input name="sending_select" type="radio" value="<?=$i.".".$j?>" onclick="enabledclass();" <?=$checkedzero?>/>
<?=$wordingset[$i][$j]?>
</td>
<?
if($j==0){
$row_h=0;
foreach($wordingset[$i] as $b1){
$row_h++;
}
?>
<td align="center" valign="middle" rowspan='<?=$row_h?>' ><br />
<input type="text" name="sid_show<?=$i?>" style="width:140px;" <?=$disabled?> value="<?=$rs_doc[sending]?>"/>
<input type="hidden" name="sid<?=$i?>" id="sid<?=$i?>" class="input" style="width:380px;" value="<?=$rs_doc[sid]?>" />
<input name="sid_select<?=$i?>" type="button" id="sid_select<?=$j?>" <?=$disabled?> onclick="MM_openBrWindow('user/org_select.php?type=organize&starget=sid_show<?=$i?>&htarget=sid<?=$i?>','add_user','addres=no,toolbar=no,scrollbars=yes,width=600,height=600')" value="ระบุผู้ลงนาม"/>
</td>
<? }
}
}else{
if(($i=="0")&&(!$rs_doc[sector])){$checkedzero="checked";}else{$checkedzero="";}
?>
<input name="sending_select" type="radio" value="<?=$i.".".$j?>" <?=$checkedzero?>/>
<?=$wordingset[$i]?>
<?
}
?>
</tr>
<?
}
?>
</table></td>
</tr>
<tr>
<td>
<!--
<input name="position_show" type="checkbox" id="position_show" value="show" />
แสดงตำแหน่งผู้ลงนาม --></td>
</tr>
</table>
<? }?> </TD>
</TR>
<TR valign="top">
<TD height="20" align="right"><span class="style1">*</span> ถึง <b>:</b> </TD>
<TD align="left">
<? if($type!="circular"){ ?>
<script language="javascript">
function autoprim(){
// alert(document.post.getting.value);
if(document.post.getting.value=='ผ'){
document.post.getting.value='ผู้ว่าราชการจังหวัด<?=$provincename?>';
}
if(document.post.getting.value=='ร'){
document.post.getting.value='รองผู้ว่าราชการจังหวัด<?=$provincename?>';
}
}
</script>
<input type="text" name="getting" id="getting" class="input" style="width:380px;" value="<?=$rs_doc[getting]?>" onkeyup="autoprim();" />
<? }else if($type=="circular"){ ?>
<?
if($id){
$sql_profile_list="
SELECT DISTINCT
doc_receive.docid,
doc_receive.group_id
FROM
doc_receive
WHERE
doc_receive.docid = '$id' AND
doc_receive.group_id LIKE 'p%'
";
$result = mysql_query($sql_profile_list)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($profile_rs = mysql_fetch_assoc($result)){
$gp_list=substr($profile_rs[group_id], 1);
$group_sql.=" AND profile_staffgroup.gid ='$gp_list' ";
$pid.=$gp_list.",";
} $pid=substr($pid, 0,-1);
if($pid){
$sql_profile_name="
SELECT
profile_staffgroup.groupname,
profile_staffgroup.gid
FROM
profile_staffgroup
WHERE
profile_staffgroup.org_id = '2'
$group_sql
";
$result = mysql_query($sql_profile_name)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($profile_rs = mysql_fetch_assoc($result)){
$text_g.=" $profile_rs[groupname],";
}
$text_g=substr($text_g, 0,-1);
if($text_g){$show_gid=$text_g;}
}
}
?><br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="width:300px;">
<? $readonly="readonly"; ?>
<textarea name="gid_show" rows="3" id="gid_show" style="width:300px;" ><?=$show_gid?></textarea></td>
<td align="left" valign="middle"><input name="pid_hide" type="hidden" id="pid_hide" <?=$readonly?> value="<?=$pid?>"/>
<input name="pid" type="hidden" id="pid" readonly="readonly" value="<?=$pid?>"/>
<input type="button" name="Button222" value="เลือกกลุ่ม" onclick="MM_openBrWindow('active_circular_g.php?type=<?=$type?>','add_user','addres=no,toolbar=no,scrollbars=yes,width=400,height=600')"/>
<br />
<input name="sid_hide" type="hidden" id="sid_hide" readonly="readonly" value="<?=$sid?>"/>
<input name="sid" type="hidden" id="sid" readonly="readonly" value="<?=$sid?>"/>
<input type="button" name="Button22" value="เลือกรายบุคคล" onclick="MM_openBrWindow('active_circular_p.php?type=<?=$type?>','add_user','addres=no,toolbar=no,scrollbars=yes,width=400,height=600')"/></td>
</tr>
</table>
<? } ?> </TD>
<tr>
<td height="20" align="right"><span class="style1">*</span> เรื่อง <b>:</b> </td>
<td><textarea name="title" rows="3" class="input" style="width:380px;"><?=$rs_doc[title]?></textarea></td>
</tr>
<!--<TR valign="top">
<TD height="20" align="right">การปฏิบัติ <B>:</B> </TD>
<TD><INPUT name="sector" type="text" class="input" id="sector" style="width:360px;" value="<?=$rs_doc[sector]?>"></TD>
</TR>-->
<TR valign="top">
<TD height="20" align="right">กำหนดชั้นความเร็ว <b>:</b> </TD>
<TD>
<select name="speed" style="width:160px;">
<option value=""> - เลือกชั้นความเร็ว - </option>
<?
$sql_speed=" SELECT * FROM speed_status ";
$result = mysql_query($sql_speed)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($speed_rs = mysql_fetch_assoc($result)){
?>
<option value="<?=$speed_rs[id]?>" <? if($speed_rs[id]==$rs_doc[speed]){echo "selected";} ?>> <?=$speed_rs[speed]?></option>
<? }?>
</select> </TD>
</TR>
<? if(!$sercet_select || $sercet_select=="on"){?>
<TR valign="top">
<TD height="20" align="right">กำหนดชั้นความลับ <b>:</b> </TD>
<TD>
<select name="secret" style="width:160px;">
<option value=""> - เลือกชั้นความลับ - </option>
<?
$sql_secret=" SELECT * FROM secret_status ";
$result = mysql_query($sql_secret)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($secret_rs = mysql_fetch_assoc($result)){
?>
<option value="<?=$secret_rs[id]?>" <? if($secret_rs[id]==$rs_doc[secret]){echo "selected";} ?>> <?=$secret_rs[secret]?></option>
<? }?>
</select> </TD>
</TR>
<? }?>
<? if($type=="get"){?>
<!--
<TR valign="top">
<TD height="20" align="right">วันรับเอกสาร <b>:</b> </TD>
<TD><? if($rs_doc[tdate] == "")
{ $ndate = date("d/m/").(date("Y") + 543);
}else{
$d = explode("-", $rs_doc[tdate]);
$ndate = $d[2]."/".$d[1]."/".($d[0] + 543);
}
?>
<input type="text" name="tdate" id="pdate" class="input" maxlength="10" style="width:120px;" value="<?=$ndate?>" readonly="readonly" />
<? if ( ($type=="get") ) { ?>
<script language='JavaScript' type="text/javascript"> if (!document.layers) { document.write("<input type=button onclick='popUpCalendar(this, post.tdate, \"dd/mm/yyyy\")' value=' เลือกวัน ' class='input'>") }</script>
<? }?></TD>
</TR>
-->
<TR valign="top">
<TD height="20" align="right">การปฏิบัติ <b>:</b> </TD>
<TD><textarea name="mission" rows="3" class="input" id="mission" style="width:400px;"><?=$rs_doc[mission]?></textarea></TD>
</TR>
<? }?>
<TR valign="top">
<TD width="157" height="20" align="right">หมายเหตุ <B>:</B> </TD>
<TD width="449"><TEXTAREA name="comment" rows="3" class="input" style="width:400px;"><?=$rs_doc[comment]?></TEXTAREA></TD>
</TR>
<!---###################################################--->
<TR>
<TD height="20" align="right" valign="top">
<IMG src="../../images/file_attach.gif" width="7" height="13" align="absmiddle"> ไฟล์เอกสารแนบ <B>:</B> </TD>
<TD>
<SCRIPT type=text/javaSCRIPT>
// FILE ADD FUNCTION
var gFiles = 0;
function addFile() {
var li = document.createElement('li');
li.setAttribute('id', 'file-' + gFiles);
li.innerHTML = '<table width="360" border="0" cellspacing="0" cellpadding="1"> <tr> <td width="350"><table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#F8F8F8"><tr><td><table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor="#FFFFFF"><tr><td><input type="file" name="file['+(gFiles)+']" class="input" /></td></tr><tr><td valign="top">รายละเอียด <strong>:</strong> <br /> <textarea name="description['+(gFiles)+']" rows="3" class="input" style="width:240px;"></textarea><br /><font color="#FF0000">*กรุณาระบุรายละเอียดไฟล์</font></td></tr></table></td></tr></table></td><td width="10" align="center" valign="bottom"><span onclick="removeFile(\'file-' + gFiles + '\')" style="cursor:pointer;"><img src="../../images/profile_sub.gif" /></span></td></tr></table><hr style="width:360px;" align="left"/>';
document.getElementById('files-root').appendChild(li);
gFiles++;
}
function removeFile(aId){
var obj = document.getElementById(aId);
obj.parentNode.removeChild(obj);
}
</SCRIPT>
<? if( ($action=="edit") &&($rs_doc[id])){
if (is_array($attachname) ) {?>
<UL>
<? foreach($attachname as $attach_id => $attach_name) { ?>
<LI><img src="../../images/attach16.gif" width="16" height="16" border=0 align="absmiddle"/>
<a href="../../files/document/<?=$attachfile[$attach_id]?>" target="_blank" title="<?=$attach_name?>"><?=trimtxt($descritment[$attach_id],32)?></a>
<a href="<?=$PHP_SELF?>?action=del_attach&id=<?=$rs_doc[id]?>&file_id=<?=$attach_id?>&type=<?=$type?>" onClick="return confirm('ท่านต้องการที่จะลบ <?=$file_attach?> ใช่หรือไม่ ?')">
<img src="../../images/profile_sub.gif" width="9" height="9" border="0" /> </a>
<? }
} ## if (is_array($file_attach) ) {
?>
</UL>
<? } ?>
<? if($type=="circular"){ echo "<font color='#FF0000'><b>กรุณาแนบเอกสาร *</b></font><br>";} ?>
<span style="cursor:pointer;" onclick="addFile()">เพิ่มเอกสารแนบ<img src="../../images/profile_plus.gif" width="9" height="9" border="0" /></span>
<ul id="files-root">
<!--<INPUT name="file" type="file" class="input" style="width:200px;">--></TD>
</TR>
<!---###################################################--->
<TR>
<TD width="157" height="20" align="right"> </TD>
<TD width="449"><INPUT type="hidden" name="action" value="<?=$action?>">
<input type="hidden" name="page" value="<?=$page?>" />
<INPUT type="hidden" name="id" value="<?=$id?>">
<INPUT type="hidden" name="type" value="<?=$type?>">
<input type="hidden" name="status" value="<?=$status?>" /></TD>
</TR>
<TR>
<TD colspan="2" align="center"><HR color="#eeeeee"><INPUT name="submit2" type="submit" class="input" style="width:100;" value="บันทึกข้อมูล"> <INPUT name="button" type="button" class="input" style="width:100;" onClick="window.location.replace('?page=<?=$page?>&type=<?=$type?>')" value="กลับหน้าหลัก"></TD>
</TR>
</TABLE>
</TD></TR>
</TABLE>
</FORM>