|
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.refid.value == ""){
alert("! กรุณาระบุเลขที่เอกสาร");
document.post.refid.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 == "circular"){
if(document.post.refid.value == ""){
alert("! กรุณาระบุเลขที่เอกสาร");
document.post.refid.focus();
return false;
}
if(document.post.pid.value == ""){
alert("! กรุณาระบุต้นทางของเอกสาร(จาก)");
document.post.Button22.focus();
return false;
}
if(document.post.title.value == ""){
alert("! กรุณาชื่อเรื่อง");
document.post.title.focus();
return false;
}
}// end กรณีเลือกหนังสือเวียน
// // 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>
<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 "เวียน"; }?> <strong>ย้อนหลัง</strong></TD>
</TR>
<!--<TR>
<TD colspan="2" height="20"><HR color="#f8f8f8"></TD>
</TR>-->
<TR>
<TD width="157" 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;}
?>
<INPUT name="docid" type="text" class="input" id="docid" style="width:120px;" value="" /> </TD>
</TR>
<TR>
<TD width="157" height="20" align="right">ที่ <B>:</B> </TD>
<TD width="449">
<INPUT name="refid" type="text" id="refid" value="<?=$rs_doc[refid]?>" /></TD>
</TR>
<TR>
<TD width="157" 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>
<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">จาก <B>:</B> </TD>
<TD><input type="text" name="sending" id="sending" class="input" style="width:180px;" value="<?=$rs_doc[sending]?>" /></TD>
</TR>
<TR valign="top">
<TD height="20" align="right">ถึง <b>:</b> </TD>
<TD align="left"><input type="text" name="getting" id="getting" class="input" style="width:380px;" value="<?=$rs_doc[getting]?>" /></TD>
<tr>
<td height="20" align="right">เรื่อง <b>:</b> </td>
<td><input name="title" type="text" class="input" style="width:380px;" value="<?=$rs_doc[title]?>" /></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>
<?}?>
<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?>" 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>