Viewing file: searchRepFollowDocDeptAllPI.php (17.42 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once "template.php";
include_once "../link/function.php";
include_once "../class/clsDocType.php";
include_once "../class/clsDepartment.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsPerson.php";
include_once "funct.php";
include_once "../link/keyThai.php";
include_once "../class/clsDocLinePosition.php";
include_once "../class/clsCollegeDetail.php"; //Chain for get collage
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDt = new doctype($oC);
$oDP = new Department($oC);
$oDlc = new DocLineConfig($oC);
$oPS = new person($oC);
$InputThai=$oSys->SearchByInputThai();
$oDlp = new docLinePosition($oC);
$oCd = new collegedetail($oC); //Chain for get collage
?>
<html>
<head>
<script language="javascript" src="../source/calendarDateInput.js"></script>
<script language="javascript" src="../source/jquery-1.9.1.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<link href="../source/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
if($_SESSION['GroupID']==SearchGroupAdmin()){
?>
<table width="100%" align="center">
<tr><td >
<fieldset>
<legend><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>"><a href="?mm=1">รายงาน</a>
<img src="../picture/ico3.gif" width="10" border="0" align="absmiddle">รายงานการติดตามหนังสือราชการที่กำหนดวันแล้วเสร็จในแต่ละวิทยาลัย</font>
</legend>
<form name="ff" target="_blank">
<table width="85%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#DADADA" style="border-collapse:collapse">
<tr><td colspan="6" align="center"><strong>การติดตามหนังสือราชการที่กำหนดวันแล้วเสร็จในแต่ละวิทยาลัย</strong></td></tr>
<tr><td> </td></tr>
<tr>
<td colspan="6" height="22"><font color="<?php echo $GLOBALS["COLOR_FONT_2"]; ?>" size="2"><strong>เลือกวิทยาลัย ::</strong></font>
<?php //== Chain ============================================================= ?>
<?php $oCd->RScollegedetail();?>
<select name = "dpId" id = "dpId">
<option value=0 >-- กรุณาเลือกวิทยาลัย --</option>
<?php while($oCd->GetRecord()){?>
<option value="<?php echo $oCd->collegeID."#".$oCd->collegeHost;?>"><?php echo $oCd->collegeAbbr;?></option>
<?php } ?>
</select>
<?php //== Chain ============================================================= ?>
</td>
</tr>
<?
$oDlc->SearchByKey($DLCID); $oDlc->GetRecord();
$oDlp->SearchByKey($oDlc->DlpID); $oDlp->GetRecord();
if($_SESSION['GroupID']==SearchGroupUsers()){
$personId=$oU->userPsCode;
$oPS->SearchByKey($personId); $oPS->GetRecord();
$oDP->SearchByKey($oPS->deptId); $oDP->GetRecord();
$deptIdPs=$oDP->deptId;
$searchByPs=1;
}else{
$oDlc->SearchByKey($DLCID); $oDlc->GetRecord();
$oDP->SearchByKey($oDlc->deptId); $oDP->GetRecord();
$deptIdPs=$oDP->deptId;
}
?>
<? if($oDlp->GSeeRepHign!='Y' && $oDlp->Gboss2!='Y'){ ?>
<tr><td colspan="6" height="22"><font color="<?php echo $GLOBALS["COLOR_FONT_2"]; ?>" size="2"><strong>หน่วยงาน :: <? echo $oDP->deptName; ?></strong></font>
<!-- CHAIN EDIT 2015/08/31 ------------------------------------------------ -->
<span id="selectDepart" class="selectDepart"></span>
<!------------------------------------------------------------------------- -->
</td></tr>
<? }else{ $seeAll="1"; ?>
<tr><td colspan="6" height="22"><font color="<?php echo $GLOBALS["COLOR_FONT_2"]; ?>" size="2"><strong>เลือกหน่วยงาน ::</strong></font>
<select name="deptId" id="deptId">
<option value="0">- เลือกหน่วยงาน -</option>
<? $oDP->SearchBydeptDateDocGroup($oDP->SearchMaxDocGroup());
while($oDP->GetRecord()){?>
<option value="<? echo $oDP->deptId;?>" <? if($oDP->deptId==$deptId){ echo "selected"; }?>><? echo $oDP->deptName; ?></option>
<? } ?>
</select>
</td></tr>
<? }?>
<tr><td colspan="6"><hr color="#000099"></hr></td></tr>
<tr><td colspan="6"><font color="<?php echo $GLOBALS["COLOR_FONT_2"]; ?>" size="2"><strong>ที่หนังสือหรือชื่อเรื่องหนังสือราชการที่ต้องการค้นหา</strong></font></td></tr>
<tr><td width="1%"> </td><td width="2%" > </td><td colspan="4">ใส่เลขทะเบียนหนังสือที่ต้องการค้นหา จาก : <input name="DocTypeNoStart" id="DocTypeNoStart" type="text" size="5"> ถึง : <input name="DocTypeNoEnd" type="text" size="5" maxlength="23" ></td></tr>
<tr><td width="1%"> </td><td width="2%" > </td><td colspan="4">ใส่ที่หนังสือราชการที่ต้องการค้นหา : <input name="DocNo" id="DocNo" type="text" size="20"></td></tr>
<tr><td width="1%"> </td><td width="2%" > </td><td colspan="4">ใส่ชื่อเรื่องหนังสือราชการที่ต้องการค้นหา : <input name="DocSubject" id="DocSubject" type="text" size="30"></td></tr>
<tr><td colspan="6"><hr color="#000099"></hr></td></tr>
<tr><td colspan="6"><font color="<?php echo $GLOBALS["COLOR_FONT_2"]; ?>" size="2"><strong>เลือกปีหรือช่วงวันที่<!--ที่ดำเนินการรับหนังสือ--></strong></font></td></tr>
<tr><td width="1%"> </td><td width="6%" > <input type="radio" name="selectVal" id="selectVal1" value="1" checked onClick="radioSelectVal(1)"></td><td colspan="4">ประจำปีปฎิทิน <input name="searchY" id="searchY" type="text" size="5" value=<? echo a2th(Date('Y')+543); ?> onkeypress="return isNumberKey('<? echo $InputThai; ?>',event)" onKeyUp="CheckInput('<? echo $InputThai; ?>','searchY')"></td></tr>
<tr><td width="1%"> </td><td width="6%" > <input type="radio" name="selectVal" id="selectVal2" value="2" onClick="radioSelectVal(2)"></td><td width="11%">ตั้งแต่วันที่ </td>
<td width="33%"><script>DateInput('DocDateCreateStart', true, 'DD/MM/YYYY','<?php echo getNowDateFw2();?>');</script></td>
<td width="2%" align="center">ถึง</td>
<td width="48%"><script>DateInput('DocDateCreateEnd', true, 'DD/MM/YYYY','<?php echo getNowDateFw2();?>');</script></td>
</tr>
<!-- ============================================================================== -->
<!-- === CHAIN Add 2015/07/14 - กำหนดวันเสร็จ ======================================================== -->
<!-- ============================================================================== -->
<tr><td width="1%"> </td><td width="6%" > <input type="radio" name="selectVal" id="selectVal3" value="3" onClick="radioSelectVal(3)"></td><td width="13%">กำหนดวันเสร็จ </td>
<td width="33%"><script>DateInput('DrsDocDueDateStart', true, 'DD/MM/YYYY','<?php echo getNowDateFw2();?>');</script></td>
<td width="2%" align="center">ถึง</td>
<td width="48%"><script>DateInput('DrsDocDueDateEnd', true, 'DD/MM/YYYY','<?php echo getNowDateFw2();?>');</script>
<input name="stDocDueDate" id="stDocDueDate" type="hidden">
</td></tr>
<!-- ============================================================================== -->
<tr><td colspan="6"><hr color="#000099"></hr></td></tr>
<tr><td colspan="6"><font color="<?php echo $GLOBALS["COLOR_FONT_2"]; ?>" size="2"><strong>เรียงลำดับข้อมูลจาก</strong></font> <input name="printorder" type="radio" value="1" id='printorder1' checked> มากไปน้อย <input name="printorder" type="radio" value="2" id='printorder2'> น้อยไปมาก</td></tr>
<tr><td colspan="6" align="right"><input name="btnReport" id="btnReport" class="btnReport" type="button" value="ออกรายงาน" onClick = "if(chkDate()) sendPage('<? echo $deptIdPs; ?>','<? echo $searchByPs; ?>','<? echo $seeAll; ?>','<? echo $DLCID; ?>'); else return false; "></td></tr>
</table><input name="selecttyped" id="selecttyped" type="hidden">
</form></fieldset>
<table width="100%" border="0" align="center">
<tr>
<td width="136" align="left"><font color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>" size="2"> <strong>หมายเหตุ
: </strong> </font></td>
<td width="1109" align="left"> <font color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>" size="2">ชื่อเรื่องหนังสือ</font></td>
</tr>
<tr>
<td width="136"> </td>
<td width="1109" align="left"> <font color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>" size="2">
1. ไม่ต้องใส่ชื่อเต็มทั้งหมด</font></td>
</tr>
<tr>
<td width="136"> </td>
<td width="1109" align="left"> <font color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>" size="2">
2. ใส่เฉพาะบางคำ ให้ระบบช่วยค้นหาได้</font></td>
</tr>
</table>
</td>
</tr>
</table>
<?php
}else{ ?>
<p align = 'center'><font color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>" size="4">สำหรับผู้ดูแลระบบเท่านั้น</font></p>
<?php } ?>
</body>
</html>
<!-- ================================================================ -->
<!-- == CHAIN ADD 2015/08/31 ======================================== -->
<!-- ================================================================ -->
<script language="javascript">
$( document ).ready(function() {
$("#btnReport").hide();
$("#dpId").on('change', function() {
var college = $(this).val();
if(college != 0){
//==Chain==============================
var foldName = "";
var dpId = document.getElementById("dpId");
var collageval = dpId.options[dpId.selectedIndex].value;
var college = collageval.split("#");
var collegeID = college[0];
var collegeHost = college[1];
if(collegeID == '99'){
foldName = "mispbri";
}else if(collegeID == '8'){
foldName = "mis";
}else{
foldName = "mistk";
}
//=====================================
// Using XMLHttpRequest
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://"+collegeHost+"/"+foldName+"/eoffice/admin/selectOptionDepartment.php", true);
// console.log("=========================");
// console.log(xhr);
// console.log(xhr.status);
// console.log(xhr.statusText);
// console.log(xhr.readyState);
// console.log(xhr.getResponseHeader('Last-Modified'));
xhr.onreadystatechange = function () {
// console.log("-------------------------");
// console.log(xhr);
// console.log(xhr.status);
// console.log(xhr.statusText);
// console.log(xhr.readyState);
// console.log(xhr.getResponseHeader('Last-Modified'));
$("#selectDepart").html(xhr.responseText);
};
xhr.send();
/* $.post("http://"+collegeHost+"/"+foldName+"/eoffice/admin/selectOptionDepartment.php","",
function(data,status){
// alert("Data: " + data + "\nStatus: " + status);
$("#selectDepart").html(data);
}); */
}else{
$("#selectDepart").html("");
$("#btnReport").hide();
}
});
});
</script>
<!-- ================================================================ -->
<script language="javascript">
function chkDate(){
val=document.getElementById('selecttyped').value;
var checkDueDate = chkDocDueDate();
if(checkDueDate == true){
if(val==3){
f = document.ff;
var date1 = f.DrsDocDueDateStart.value.split("/");
var date2 = f.DrsDocDueDateEnd.value.split("/");
//Set the two dates
date1 = new Date(eval(date1[2]), eval(date1[1]-1), eval(date1[0]));
date2 = new Date(eval(date2[2]), eval(date2[1]-1), eval(date2[0])); //Month is 0-11 in JavaScript
//Set 1 day in milliseconds
var one_day = 1000*60*60*24;
//Calculate difference btw the two dates, and convert to days
var diff = Math.ceil((date2.getTime()-date1.getTime())/(one_day));
if(diff < 0){
alert("กรุณาตรวจสอบช่วง 'วันที่เริ่มต้น' ควรน้อยกว่า 'วันที่สิ้นสุด' !");
return false;
}else{
return true;
}
}else if(val == 2){
f = document.ff;
var date1 = f.DocDateCreateStart.value.split("/");
var date2 = f.DocDateCreateEnd.value.split("/");
//Set the two dates
date1 = new Date(eval(date1[2]), eval(date1[1]-1), eval(date1[0]));
date2 = new Date(eval(date2[2]), eval(date2[1]-1), eval(date2[0])); //Month is 0-11 in JavaScript
//Set 1 day in milliseconds
var one_day = 1000*60*60*24;
//Calculate difference btw the two dates, and convert to days
var diff = Math.ceil((date2.getTime()-date1.getTime())/(one_day));
if(diff < 0){
alert("กรุณาตรวจสอบช่วง 'วันที่เริ่มต้น' ควรน้อยกว่า 'วันที่สิ้นสุด' !");
return false;
}else{
return true;
}
}else{
return true;
}
}else{
return false;
}
}
//=================================================================================
//=================================================================================
//=================================================================================
function chkDocDueDate(){
var stDocDueDate = document.getElementById('stDocDueDate').value;
if(stDocDueDate==1){
f = document.ff;
var date1 = f.DrsDocDueDateStart.value.split("/");
var date2 = f.DrsDocDueDateEnd.value.split("/");
//Set the two dates
date1 = new Date(eval(date1[2]), eval(date1[1]-1), eval(date1[0]));
date2 = new Date(eval(date2[2]), eval(date2[1]-1), eval(date2[0])); //Month is 0-11 in JavaScript
//Set 1 day in milliseconds
var one_day = 1000*60*60*24;
//Calculate difference btw the two dates, and convert to days
var diff = Math.ceil((date2.getTime()-date1.getTime())/(one_day));
if(diff < 0){
alert("กรุณาตรวจสอบช่วง 'วันที่เริ่มต้น' ควรน้อยกว่า 'วันที่สิ้นสุด' !");
return false;
}else{
return true;
}
}else{
return true;
}
}
//==================================================================================
function sendPage(q,p,r,t) {
// sendPage('<? echo $deptIdPs; ?>','<? echo $searchByPs; ?>','<? echo $seeAll; ?>','<? echo $DLCID; ?>')
if($("#dpId").val() == 0){
alert("กรุณาเลือกหน่วยงาน");
return false;
}
if($("#deptId").val()==0){
alert("กรุณาเลือกหน่วยงาน");
document.ff.deptId.focus();
return false ;
}
var links;
var DocSubject=document.ff.DocSubject.value;
var DocNo=document.ff.DocNo.value;
var DocTypeNoStart=document.ff.DocTypeNoStart.value;
var DocTypeNoEnd=document.ff.DocTypeNoEnd.value;
var printorder1=document.getElementById('printorder1').value;
var printorder2=document.getElementById('printorder2').value;
//==============================================================================
//=== CHAIN Add 2015/07/14 - กำหนดวันเสร็จ =======================================================
//==============================================================================
var DocDueDateStart=0;
var DocDueDateEnd=0;
var stDocDueDate = document.getElementById('selecttyped').value;
if(stDocDueDate==3){
DocDueDateStart = document.ff.DrsDocDueDateStart.value;
DocDueDateEnd = document.ff.DrsDocDueDateEnd.value;
}
//==============================================================================
var yearDoc = 0;
var date1 = 0;
var date2 = 0;
if(document.getElementById('printorder1').checked==1){
printorder=1;
}else if(document.getElementById('printorder2').checked){
printorder=2;
}
/*
if(r==1){ //head
var deptId=document.ff.deptId.value;
}else{
var deptId=q;
} */
var deptId = $("#deptId").val()
if(DocTypeNoEnd==""){
DocTypeNoEnd=DocTypeNoStart;
}else if(DocTypeNoStart==""){
DocTypeNoStart=DocTypeNoEnd;
}
if(document.getElementById('selecttyped').value == 1 || document.getElementById('selecttyped').value==''){
var yearDoc = document.ff.searchY.value;
}else if(document.getElementById('selecttyped').value == 2){
var date1 = document.ff.DocDateCreateStart.value;
var date2 = document.ff.DocDateCreateEnd.value;
}
// filename="printRepFollowDocDeptAllPI.php"
//==============================================================================
//== CHAIN ADD 2015/09/01 Check URL College ====================================
//==============================================================================
var college = $("#dpId").val();
if(college != 0){
//==Chain==============================
var foldName = "";
var dpId = document.getElementById("dpId");
var collageval = dpId.options[dpId.selectedIndex].value;
var college = collageval.split("#");
var collegeID = college[0];
var collegeHost = college[1];
if(collegeID == '99'){
foldName = "mispbri";
}else if(collegeID == '8'){
foldName = "mis";
}else{
foldName = "mistk";
}
}
// console.log($("#dpId").val());
// console.log($("#deptId").val());
//==============================================================================
var mainURL = "http://"+collegeHost+"/"+foldName+"/eoffice/admin/printRepFollowDocDeptAllPI.php";
links = "?DocSubject="+DocSubject+"&DocNo="+DocNo+'&start='+date1+'&end='+date2+"&yearDoc="+yearDoc+"&DocTypeNoStart="+DocTypeNoStart+"&DocTypeNoEnd="+DocTypeNoEnd+"&deptId="+deptId+"&seeAll="+r+"&dlcid="+t+"&printorder="+printorder;
//=== CHAIN Add 2015/07/14 - กำหนดวันเสร็จ =======================================================
if(p!=1){
links=links+"&DocDueDateStart="+DocDueDateStart+"&DocDueDateEnd="+DocDueDateEnd;
}
links = mainURL+links;
console.log(links);
//==============================================================================
// window.location.href=links;
window.open(links,'','toolbar=0, scrollbars=1, location=0, status=1, menubar=1, resizable=1, width=950, height=620, left = 150, top = 15');
}
function radioSelectType(val){
document.getElementById('RPtype').value=val;
}
function radioSelectVal(val){
document.getElementById('selecttyped').value=val;
}
</script>
|