require_once("conf_func.php"); $whTbl=trim($_REQUEST['whTbl']); if(trim($_REQUEST['st_mm'])=="" and trim($_REQUEST['st_yy'])!=""){ $job_start=trim($_REQUEST['st_yy'])."0101"; }else if(trim($_REQUEST['st_mm'])!="" and trim($_REQUEST['st_yy'])!=""){ $job_start=trim($_REQUEST['st_yy']).str_pad(trim($_REQUEST['st_mm']),2,"0",STR_PAD_LEFT)."01"; }else{ $job_start=""; } if(trim($_REQUEST['ed_mm'])!="" and trim($_REQUEST['ed_yy'])!=""){ $endyear=cal_days_in_month(CAL_GREGORIAN, (int)trim($_REQUEST['ed_mm']), (int)trim($_REQUEST['ed_yy']) ); $job_end=trim($_REQUEST['ed_yy']).str_pad(trim($_REQUEST['ed_mm']),2,"0",STR_PAD_LEFT).$endyear; }else if(trim($_REQUEST['ed_mm'])=="" and trim($_REQUEST['ed_yy'])!=""){ $job_end=trim($_REQUEST['ed_yy'])."1231"; }else{ $job_end=""; } $job_name=trim($_REQUEST['job_name']); $job_owner=trim($_REQUEST['job_owner']); $client=trim($_REQUEST['client']); $type_endowment=trim($_REQUEST['type_endowment']); $type_id=trim($_REQUEST['type_id']); $job_status=trim($_REQUEST['job_status']); $type_ref=trim($_REQUEST['type_ref']); $emp_code=trim($_REQUEST['emp_code']); $orderby=trim($_REQUEST['orderby']); $ord=trim($_REQUEST['ord'])=="" ? "desc" : trim($_REQUEST['ord']); $wheis=""; if($job_name!=""){ $wheis.=" AND j.job_name LIKE '%".mysql_real_escape_string(str_replace(" ","%",$job_name))."%' "; } if($job_owner!=""){ $wheis.=" AND j.job_owner LIKE '%".mysql_real_escape_string(str_replace(" ","%",$job_owner))."%' "; } if($client!=""){ $wheis.=" AND j.client LIKE '%".mysql_real_escape_string(str_replace(" ","%",$client))."%' "; } if($type_endowment!=""){ $wheis.=" AND j.type_endowment='".mysql_real_escape_string($type_endowment)."' "; } if($type_id!=""){ $wheis.=" AND j.type_id='".mysql_real_escape_string($type_id)."' "; } if($job_status=="y"){ $wheis.=" AND j.job_status='y' "; }else if($job_status=="h"){ $wheis.=" AND j.job_status!='y' "; } if($type_ref!=""){ $wheis.=" AND j.type_ref='".mysql_real_escape_string($type_ref)."' "; } if($emp_code!=""){ $wheis.=" AND jt.emp_code='".mysql_real_escape_string($emp_code)."' "; } if(strlen($job_start)==8 and strlen($job_end)==8){ $wheis.=" AND j.job_start BETWEEN '".mysql_real_escape_string($job_start)."' AND '".mysql_real_escape_string($job_end)."' "; }else if(strlen($job_start)==0 and strlen($job_end)==8){ $wheis.=" AND IF(j.job_end<>'',j.job_end,j.job_start) <= ".$job_end ; }else if(strlen($job_start)==8 and strlen($job_end)==0){ $wheis.=" AND j.job_start >= ".$job_start ; }else{ } $sqlData="SELECT j .*,jt.emp_code,jt.job_postion,jy.type_name FROM job j LEFT JOIN job_temp jt ON ( j.job_code = jt.job_code ) LEFT JOIN job_type jy ON(j.type_id=jy.type_id AND j.type_ref=jy.type_ref) WHERE 1 ".$wheis." "; $rstotalRow=mysql_query($sqlData."GROUP BY j.job_code "); $totalrow = mysql_num_rows($rstotalRow); mysql_free_result($rstotalRow); $rsSUB=mysql_query("SELECT * FROM employee_group ORDER BY emp_sub, g_name_th ;"); if($rsSUB){ $s=0; while($rowSUB=mysql_fetch_assoc($rsSUB)){ $gGID[trim($rowSUB['emp_group'])]=trim($rowSUB['g_name_th']); } mysql_free_result($rsSUB); } //---------------------SPILT page-----------------------// if((int)$_REQUEST['page']==0){ $page=1; }else{ $page=(int)$_REQUEST['page']; } $pagesize = (int)$_REQUEST['pagesize']==0 ? 20 : (int)$_REQUEST['pagesize'] ; $totalpage = ceil($totalrow/$pagesize); $start_from = ($page-1) * $pagesize; //------------------End Spit page-------------------// $linkPage=$PHP_SELF."?type_ref=".$type_ref."&emp_code=".$emp_code."&st_mm=".trim($_REQUEST['st_mm'])."&st_yy=".trim($_REQUEST['st_yy'])."&ed_mm=".trim($_REQUEST['ed_mm'])."&ed_yy=".trim($_REQUEST['ed_yy'])."&pagesize=".trim($pagesize).""; $rsListName=mysql_query(" SELECT emp_code, emp_name FROM employee WHERE emp_status!='ลาออก' and emp_status!='เสียชีวิต' and emp_status!='ตัดโอนอัตรา' and emp_status!='เกษียณอายุราชการ' ORDER BY emp_name"); $whTbl="job"; if($rsListName){ $txtOP=''; while($rowN=mysql_fetch_assoc($rsListName)){ $emp_name[$rowN['emp_code']]=$rowN['emp_name']; $txtOP.=""; } mysql_free_result($rsListName); } // end if $rsListName // $arrGropEmployee // array Group from require_once conf_func.php ?>
include("menu_navi.php"); ?>
รายงานผลงานต่างๆ >> รายงาน( วิจัย / งานบริการวิชาการ / งานสร้างสรรค์ / ทำนุบำรุงศิลปะวัฒนธรรม)
ค้นหาข้อมูล รายงาน( วิจัย / งานบริการวิชาการ / งานสร้างสรรค์ / ทำนุบำรุงศิลปะวัฒนธรรม)
$Worder=" ORDER BY j.job_code ".$ord." ";
if($orderby!="emp_code" and $orderby!=""){
$Worder=" ORDER BY j.".$orderby." ".$ord." ";
}else if($orderby=="emp_code" and $orderby!=""){
$Worder=" ORDER BY jt.emp_code ".$ord." ";
}
if($emp_code!=""){
$sqlData2=$sqlData." ".$wheis." ".$Worder." LIMIT ".$start_from." , ".$pagesize." ";
}else{
$sqlData2="SELECT te.* ,pp.byMD,pp.emp_group ,jt.emp_code,jt.job_postion FROM ( SELECT j .* ,jy.type_name FROM job j LEFT JOIN job_type jy ON(j.type_id=jy.type_id AND j.type_ref=jy.type_ref) WHERE 1 ".$wheis." ".$Worder." LIMIT ".$start_from." , ".$pagesize." ) as te LEFT JOIN job_temp jt ON ( te.job_code = jt.job_code ) LEFT JOIN job_plan_status pp ON ( te.job_code = pp.job_code ) ";
}
$rsData=mysql_query($sqlData2);
//echo $sqlData2;
echo ""; if($rsData){ ?> รายงาน( วิจัย / งานบริการวิชาการ / งานสร้างสรรค์ / ทำนุบำรุงศิลปะวัฒนธรรม)
|