MINI SHELL

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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/eoffice/application/document/take_doc.php
<?
session_start();
//$bypass=1;
$db_mode="self";
include("../../config/config.inc.php");
?>
<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.getting.length);
if(document.post.getting.selectedIndex== document.post.getting.length-1){
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 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;
}
function checkForm() {
//	alert(document.post.pid_req.checked);
	if(document.post.pid_req.checked==false){
		if(!checkID(document.post.pid.value)){
		alert('รหัสบัตรประชาชนไม่ถูกต้อง กรุณาตรวจอีกครั้ง !!');
		return false;
		}else{
	//	alert('รหัสบัตรประชาชนถูกต้อง!!');
		return true;
		}
	}

//	ลงทะเบียนรับใช้ หมายเลข 1  จำนวน 13 ตัว
/*
	 if(document.post.pid.value='1111111111111'){ 
	 return true;
	 }else{
	 return false;
	 }
*/

}
</SCRIPT>

<?

if ($_SERVER[REQUEST_METHOD] == "POST"){ 

	$update_code="";
	$t=0;
	$taking_user="";
	if($checkbox){$i=0;
		foreach($checkbox as $valid => $valnum){
		if($t>0){$update_code.=" or ";}else{$update_code.=" AND ( ";}
		$t++;
		$update_code.="doc_receive.staff_id = $valid ";
		$taking_user.="$valid,";
			$i++;
			$sql_taking="
			INSERT INTO `doc_take` (`id`,`docid`,`staffid`,`name`,`pid`,`position`,`group`) VALUES (NULL,'$id','$valid','$name','$pid','$position','$group')
		";
	$result = mysql_query($sql_taking)or die("Query line " . __LINE__ . " error<hr>".mysql_error());

$doc_history="ลงทะเบียนรับหนังสือ";
$action="take";
doclog($id,	$doc_reciveid, $li[staffid],	$textbox[$valid],$session_staffid,$textbox[$valid],'',				$doc_history ,	'take');
		}
	}
	if($t>0){$update_code.=" ) ";}

		addlog("บันทึกผู้รับต้นฉบับ $id ประกอบด้วย $taking_user ");
		$sql_update="
		UPDATE doc_receive SET timepaid=now() , paidstaffid='$session_staffid', status='200' WHERE  docid='$id'  $update_code 
		";
		if($i>0){
		$result = mysql_query($sql_update)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
		}


	?>
	<SCRIPT language="javascript">
	 window.close();
	</SCRIPT>
	<?
	exit;
}
?>



<HTML>
<HEAD>
<TITLE> เลือกบันทึกการรับหนังสือจริง </TITLE>
<META http-equiv="Content-Type" content="text/html; charset=windows-874">
<SCRIPT type="text/javascript" src="dtree/dtree.js"></SCRIPT>
<SCRIPT src="../../common/functions.js" type="text/javascript" language="javascript"></SCRIPT>
<LINK href="../../common/style_menu.css" rel=StyleSheet type="text/css">
<LINK href="../../common/dtree.css" rel="StyleSheet" type="text/css"  />
<LINK href="../../common/style.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY bgcolor="#FFFFFF">
<FORM action="<?=$PHP_SELF?>?type=get&action=add" name="post" method="post" enctype="multipart/form-data" onSubmit="return checkForm();" >
<TABLE width="101%" border="0" align="right" cellpadding="10" cellspacing="0">
<TR>
<TD height="18">

<TABLE width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
	<TR>
		<TD><TABLE width="100%" border="0" cellspacing="1" cellpadding="1">
			<TR>
				<TD colspan="2" bgcolor="#CCCCCC"><STRONG>ผู้รับหนังสือ</STRONG></TD>
			</TR>
<?	
$sql_group="
SELECT
*
FROM
doc_take
WHERE
doc_take.docid = $id 
";

$result = mysql_query($sql_group)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($hrs = mysql_fetch_assoc($result)){
$list[$hrs[staffid]]="ผู้รับ : $hrs[name] <br> บัตรประจำตัวประชาชน : $hrs[pid] <br> ตำแหน่ง : $hrs[position] <br>แผนก : $hrs[position] <br>";
}

$sql_group="
SELECT
$eoffice_select.doc_receive.staff_id,
$table_staff.prename,
$table_staff.staffname,
$table_staff.staffsurname,
$eoffice_select.doc_receive.timepaid
FROM
$eoffice_select.doc_receive
Inner Join $table_staff ON $table_staff.staffid = $eoffice_select.doc_receive.staff_id
WHERE
$eoffice_select.doc_receive.docid =  '$id'
Group by $table_staff.staffid
";
$result = mysql_query($sql_group)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$row_check=mysql_num_rows($result );
while($hrs = mysql_fetch_assoc($result)){

?>			
			<TR>
				<TD align="left" valign="top">



					<LABEL <? if($hrs[timepaid]){ ?>onClick="showEle('display<?=$hrs[staff_id]?>');" <?}?>>
					<INPUT type="checkbox" name="checkbox[<?=$hrs[staff_id]?>]" value="<?=$hrs[staff_id]?>" <? if($hrs[timepaid]){echo "checked  disabled";}?>>
					<INPUT type="hidden" name="textbox[<?=$hrs[staff_id]?>]" value="<?=$hrs[prename].$hrs[staffname]." ".$hrs[staffsurname]?>">

					<? if($hrs[timepaid]){echo "<u>";}?>
					<?=$hrs[prename].$hrs[staffname]." ".$hrs[staffsurname]?>
					<? if($hrs[timepaid]){echo "</u>";}?>
					</LABEL>

					<? if($hrs[timepaid]){?>
						<? $g_check="none"; ?>
						<DIV id="display<?=$hrs[staff_id]?>" NAME="display<?=$hrs[staff_id]?>" style="display:<?=$g_check?>;">
						
									<TABLE>
									<TR>
										<TD width="20">&nbsp;</TD>
										<TD><?=$list[$hrs[staff_id]]?></TD>
									</TR>
									</TABLE>
							
						
						
					<? }?>

					</DIV>
					
					
					</TD>
			</TR>
<? } // }?>
			<TR>
				<TD colspan="2" align="center"><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?>" />
					<BR>

					<?if($row_check){?>
					<TABLE width="90%" border="0" cellspacing="0" cellpadding="0">
						<TR>
							<TD width="30%" valign="top">รหัสบัตรประชาชน</TD>
							<TD><INPUT name="pid" type="text" id="pid">
								<BR>
								<? if($pid_req=="on"){?>
								<INPUT name="pid_req" type="checkbox" ckeched>
								ละเว้นบัตรประชาชน <? }?>
							</TD>
						</TR>
						<TR>
							<TD>ชื่อ นามสกุล</TD>
							<TD><INPUT name="name" type="text" id="name"></TD>
						</TR>
						<TR>
							<TD>ตำแหน่ง</TD>
							<TD><INPUT name="position" type="text" id="position"></TD>
						</TR>
						<TR>
							<TD>หน่วยงาน</TD>
							<TD><INPUT name="group" type="text" id="group"></TD>
						</TR>
					</TABLE>
					<?}else{ echo "หนังสือฉบับนี้ยังไม่มีการส่งต่อในระบบสารบรรณอิเล็กทรอนิกส์ <br> ยังไม่สามารถลงทะเบียนรับต้นฉบับได้";}?>
					</TD>
			</TR>
			<TR>
				<TD colspan="2">
				<INPUT type="submit" name="Button" value="บันทึกการรับหนังสือ" onClick="return confirm('ต้องการบันทึกใช่หรือไม่ ?');sendvalue();">
				</TD>
			</TR>
		</TABLE></TD>
	</TR>
</TABLE></TD>
</TR>  
</TABLE>
</FORM>
</BODY>
</HTML>

Anon7 - 2021