通达OA官方提供的30源代码,感觉很实在
源代码在线查看: search.php
include_once("inc/auth.php");
include_once("inc/check_type.php");
include_once("inc/utility_org.php");
include_once("inc/utility_field.php");
include_once("check_priv.php");
?>
人事档案查询
function hrms_detail(USER_ID)
{
URL="print?USER_ID="+USER_ID;
myleft=(screen.availWidth-500)/2;
window.open(URL,"read_notify","height=500,width=690,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top=150,left="+myleft+",resizable=yes");
}
function delete_all(condition_query)
{
msg='确认删除以上信息吗?';
if(window.confirm(msg))
{
URL="delete_hrms.php?condition_query="+condition_query;
window.location=URL;
}
}
$CUR_DATE=date("Y-m-d",time());
$query="";
//----------- 合法性校验 ---------
if($BIRTHDAY_MIN!="")
{
if($urlstr=="")$urlstr="BIRTHDAY_MIN=".$BIRTHDAY_MIN;
else $urlstr=$urlstr."&BIRTHDAY_MIN=".$BIRTHDAY_MIN;
$query.=" and HR_BIRTHDAY>='$BIRTHDAY_MIN'";
}
if($BIRTHDAY_MAX!="")
{
if($urlstr=="")$urlstr="BIRTHDAY_MAX=".$BIRTHDAY_MAX;
else $urlstr=$urlstr."&BIRTHDAY_MAX=".$BIRTHDAY_MAX;
$query.=" and HR_BIRTHDAY }
if($WORK_DATE_MIN!="")
{
if($urlstr=="")$urlstr="WORK_DATE_MIN=".$WORK_DATE_MIN;
else $urlstr=$urlstr."&WORK_DATE_MIN=".$WORK_DATE_MIN;
$query.=" and WORK_DATE>='$WORK_DATE_MIN'";
}
if($WORK_DATE_MAX!="")
{
if($urlstr=="")$urlstr="WORK_DATE_MAX=".$WORK_DATE_MAX;
else $urlstr=$urlstr."&WORK_DATE_MAX=".$WORK_DATE_MAX;
$query.=" and WORK_DATE }
if($JOIN_DATE_MIN!="")
{
if($urlstr=="")$urlstr="JOIN_DATE_MIN=".$JOIN_DATE_MIN;
else $urlstr=$urlstr."&JOIN_DATE_MIN=".$JOIN_DATE_MIN;
$query.=" and JOIN_DATE>='$JOIN_DATE_MIN'";
}
if($JOIN_DATE_MAX!="")
{
if($urlstr=="")$urlstr="JOIN_DATE_MAX=".$JOIN_DATE_MAX;
else $urlstr=$urlstr."&JOIN_DATE_MAX=".$JOIN_DATE_MAX;
$query.=" and JOIN_DATE }
if($AGE_MIN!="")
{
if($urlstr=="")$urlstr="AGE_MIN=".$AGE_MIN;
else $urlstr=$urlstr."&AGE_MIN=".$AGE_MIN;
$AGE=intval($AGE_MIN);
if(!is_int($AGE)||$AGE {
Message("错误","年龄应为正整数!");
Button_Back();
exit;
}
$YEAR_MIN=date("Y",time())-$AGE;
$YEAR_MIN.=date("-m-d",time());
$query.=" and HR_BIRTHDAY }
if($AGE_MAX!="")
{
if($urlstr=="")$urlstr="AGE_MAX=".$AGE_MAX;
else $urlstr=$urlstr."&AGE_MAX=".$AGE_MAX;
$AGE=intval($AGE_MAX);
if(!is_int($AGE)||$AGE {
Message("错误","年龄应为正整数!");
Button_Back();
exit;
}
$YEAR_MAX=date("Y",time())-$AGE;
$YEAR_MAX.=date("-m-d",time());
$query.=" and HR_BIRTHDAY>='$YEAR_MAX'";
}
if($BIRTHDAY_MIN!="" || $BIRTHDAY_MAX!="" || $AGE_MIN!="" || $AGE_MAX!="")
$query.=" and HR_BIRTHDAY!='0000-00-00' and HR_BIRTHDAY!='1900-01-01'";
//------------------------ 生成条件字符串 ------------------
if ($TO_ID!="")
{
if ($TO_ID!="ALL_DEPT")
{
$DEPT_ID=$TO_ID;
if (substr($DEPT_ID,-1)==",")
$DEPT_ID=substr($DEPT_ID,0,-1);
$DEPT_ID="(".$DEPT_ID.")";
$query.=" and b.DEPT_ID in $DEPT_ID";
}
}
if($SEX!="")
{
if($urlstr=="")$urlstr="SEX=".$SEX;
else $urlstr=$urlstr."&SEX=".$SEX;
$query.=" and a.SEX='$SEX'";
}
if($MARRY!="")
{
if($urlstr=="")$urlstr="MARRY=".$MARRY;
else $urlstr=$urlstr."&MARRY=".$MARRY;
$query.=" and MARRY='$MARRY'";
}
if($EDUCATION!="")
{
if($urlstr=="")$urlstr="EDUCATION=".$EDUCATION;
else $urlstr=$urlstr."&EDUCATION=".$EDUCATION;
$query.=" and EDUCATION='$EDUCATION'";
}
if($POLITICS!="")
{
if($urlstr=="")$urlstr="POLITICS=".$POLITICS;
else $urlstr=$urlstr."&POLITICS=".$POLITICS;
$query.=" and POLITICS='$POLITICS'";
}
if($NO!="")
{
if($urlstr=="")$urlstr="NO=".$NO;
else $urlstr=$urlstr."&NO=".$NO;
$query.=" and NO like '%".$NO."%'";
}
if($USERNAME!="")
{
if($urlstr=="")$urlstr="USERNAME=".$USERNAME;
else $urlstr=$urlstr."&USERNAME=".$USERNAME;
$query.=" and b.USER_NAME like '%".$USERNAME."%'";
}
if($NATION!="")
{
if($urlstr=="")$urlstr="NATION=".$NATION;
else $urlstr=$urlstr."&NATION=".$NATION;
$query.=" and NATION like '%".$NATION."%'";
}
if($CARD_NO!="")
{
if($urlstr=="")$urlstr="CARD_NO=".$CARD_NO;
else $urlstr=$urlstr."&CARD_NO=".$CARD_NO;
$query.=" and CARD_NO like '%".$CARD_NO."%'";
}
if($NATIVE_PLACE!="")
{
if($urlstr=="")$urlstr="NATIVE_PLACE=".$NATIVE_PLACE;
else $urlstr=$urlstr."&NATIVE_PLACE=".$NATIVE_PLACE;
$query.=" and NATIVE_PLACE='$NATIVE_PLACE'";
}
if($HUKOU_PLACE!="")
{
if($urlstr=="")$urlstr="HUKOU_PLACE=".$HUKOU_PLACE;
else $urlstr=$urlstr."&HUKOU_PLACE=".$HUKOU_PLACE;
$query.=" and HUKOU_PLACE like '%".$HUKOU_PLACE."%'";
}
if($SPECIALITY!="")
{
if($urlstr=="")$urlstr="SPECIALITY=".$SPECIALITY;
else $urlstr=$urlstr."&SPECIALITY=".$SPECIALITY;
$query.=" and SPECIALITY like '%".$SPECIALITY."%'";
}
if($SCHOOL!="") //毕业院校
{
if($urlstr=="")
$urlstr="SCHOOL=".$SCHOOL;
else
$urlstr=$urlstr."&SCHOOL=".$SCHOOL;
$query.=" and SCHOOL like '%".$SCHOOL."%'";
}
if(($SELECTITEM!="-1")&&($TContext!="")) //其他 like '%".$NO."%'";
{
if($urlstr=="")
$urlstr="$SELECTITEM like '%".$TContext."%'";
else
$urlstr=$urlstr."&$SELECTITEM like '%".$TContext."%'";
$query.=" and $SELECTITEM like '%".$TContext."%'";
}
if($CONTRACTTYPE!="")
{
if($urlstr=="")$urlstr="CONTRACTTYPE=".$CONTRACTTYPE;
else $urlstr=$urlstr."&CONTRACTTYPE=".$CONTRACTTYPE;
$query.=" and CONTRACTTYPE='$CONTRACTTYPE'";
}
if($POST!="")
{
if($urlstr=="")$urlstr="POST=".$POST;
else $urlstr=$urlstr."&POST=".$POST;
$query.=" and POST like '%".$POST."%'";
}
if($TECH_POST!="")
{
if($urlstr=="")$urlstr="TECH_POST=".$TECH_POST;
else $urlstr=$urlstr."&TECH_POST=".$TECH_POST;
$query.=" and TECH_POST='$TECH_POST'";
}
if($ORDERFIELD!="")
{
if($ORDERSIGN=="DOWN")
{
$ORDERTYPE="ASC";
}
if($ORDERSIGN=="UP")
{
$ORDERTYPE="DESC";
}
$OREDERBY=" ORDER BY ".$ORDERFIELD." ".$ORDERTYPE;
}
$query1="select * from HRMS a
LEFT OUTER JOIN USER b ON a.USER_ID = b.USER_ID
LEFT OUTER JOIN DEPARTMENT f ON b.DEPT_ID=f.DEPT_ID
LEFT OUTER JOIN USER_PRIV g ON b.USER_PRIV=g.USER_PRIV";
$query1.=" where 1=1";
$query1.=$query;
$query1.=field_where_str("HRMS",$_POST,"a.USER_ID");
$query1.=$WHERE_STR;
$cursor= exequery($connection,$query1);//echo $query1;
$HRMS_COUNT=0;
while($ROW=mysql_fetch_array($cursor))
{
$DEPT_ID=$ROW["DEPT_ID"];
$USER_ID=$ROW["USER_ID"];
$HRMS_COUNT++;
}
$condition_query=$query1;
//echo $condition_query;
//break;
?>
人事档案查询结果
共 条信息
$HRMS_COUNT=0;
$query1="select b.USER_ID,b.USER_NAME,DEPT_NAME,b.DEPT_ID,a.SEX,HR_BIRTHDAY,CARD_NO,NO,NATION,NATIVE_PLACE,TECH_POST,HUKOU_PLACE,POLITICS from HRMS a
LEFT OUTER JOIN USER b ON a.USER_ID = b.USER_ID
LEFT OUTER JOIN DEPARTMENT f ON b.DEPT_ID=f.DEPT_ID
LEFT OUTER JOIN USER_PRIV g ON b.USER_PRIV=g.USER_PRIV";
$query1.=" where 1=1";
$query1.=$query.field_where_str("HRMS",$_POST,"a.USER_ID").$WHERE_STR.$OREDERBY;
$cursor= exequery($connection,$query1);//echo $query1;
while($ROW=mysql_fetch_array($cursor))
{
$NATIVE_PLACENAME="";
$USER_ID=$ROW["USER_ID"];
$USER_NAME=$ROW["USER_NAME"];
$DEPT_NAME=$ROW["DEPT_NAME"];
$DEPT_ID=$ROW["DEPT_ID"];
$SEX=$ROW["SEX"];
$HR_BIRTHDAY=$ROW["HR_BIRTHDAY"];
$CARD_NO=$ROW["CARD_NO"];
$NO=$ROW["NO"];
$NATION=$ROW["NATION"];
$NATIVE_PLACE=$ROW["NATIVE_PLACE"];
$TECH_POST=$ROW["TECH_POST"];
$HUKOU_PLACE=$ROW["HUKOU_PLACE"];
$POLITICS=$ROW["POLITICS"];
$query1 = "SELECT CODE_NAME from SYS_CODE where PARENT_NO='AREA' and CODE_NO='$NATIVE_PLACE'";
$cursor1= exequery($connection,$query1);
if($ROW=mysql_fetch_array($cursor1))$NATIVE_PLACENAME=$ROW["CODE_NAME"];
$HRMS_COUNT++;
if($SEX=="0")
$SEX_DESC="男";
else if($SEX=="1")
$SEX_DESC="女";
else
$SEX_DESC="";
if($POLITICS==1) $POLITICS= "群众";
elseif($POLITICS==2) $POLITICS= "团员";
elseif($POLITICS==3) $POLITICS= "党员";
elseif($POLITICS==4) $POLITICS= "预备党员";
if($HR_BIRTHDAY=="0000-00-00"||$HR_BIRTHDAY=="1900-01-01")
$HR_BIRTHDAY="";
if($HRMS_COUNT==1)
{
?>
操作
}
?>
}
if($HRMS_COUNT==0)
{
Message("","无符合条件的人事档案信息");
Button_Back();
exit;
}
?>
{
?>
}
?>