⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 update.asp

📁 这是一个自己研发的薪酬管理系统
💻 ASP
字号:
<%@ Language=VBScript %>
<%
'文件功能:工资管理---增加、修改
'版权所有:万户网络
'编写人员:房鹏
'编写时间:2003-8-12
'修改人员:房鹏
'修改时间:2003-8-13,003-8-22
'修改目的:设立权限控制,重写工资栏目调用方式
%>
<!-- #include file="../Common/Cls_DbProcess2.1.asp" -->
<!-- #include file="../wh_salaries/Cls_wh_salaries.asp" -->
<!-- #include file="../pub/conn.asp" -->
<!-- #include file="../pub/fun.asp" -->
<%call checklogin()%>

<%
if session("right")<3 then
	dim lr
	lr="<font color=red>"&now()&"有"&session("name")&"试图修改工资总表  IP:"&REQUEST.SERVERVARIABLES("REMOTE_ADDR")&"</font>"
    call savelog("../pub/error.htm",lr)
	call savedatalog(now(),session("name"),"试图修改工资总表",REQUEST.SERVERVARIABLES("REMOTE_ADDR"),2)
	response.redirect("../error.asp?msg=2")
end if
salary_type=request("salary_type")
select case(salary_type)
	case 1
		sql1="select * from wh_salaryItems1 where item1_isused=1 and item1_tech=1 order by item1_number"
		sql2="select * from wh_salaryItems2 where item2_isused=1 and item2_tech=1 order by item2_number"
	case 2
		sql1="select * from wh_salaryItems1 where item1_isused=1 and item1_market=1 order by item1_number"
		sql2="select * from wh_salaryItems2 where item2_isused=1 and item2_market=1 order by item2_number"
	case 3
		sql1="select * from wh_salaryItems1 where item1_isused=1 and item1_adm=1 order by item1_number"
		sql2="select * from wh_salaryItems2 where item2_isused=1 and item2_adm=1 order by item2_number"
	case 4
		sql1="select * from wh_salaryItems1 where item1_isused=1 and item1_other=1 order by item1_number"
		sql2="select * from wh_salaryItems2 where item2_isused=1 and item2_other=1 order by item2_number"
	case else
		sql1="select * from wh_salaryItems1 where item1_isused=1 order by item1_number"
		sql2="select * from wh_salaryItems2 where item2_isused=1 order by item2_number"
end select

dim Str_salary_date                        '工资发放时间
dim Str_salary_month                       '月份
dim Str_employee_id                        '员工ID

    Str_salary_date                        = trim(request.form("salary_date"))
    Str_salary_month                       = trim(request.form("salary_month"))
    Str_employee_id                        = trim(request.form("employee_id"))
	Int_Count=1
	if (not (IsNumeric(Str_salary_month))) then
        Str_Mess  = Str_Mess  +"\n"+ cstr(Int_Count) + ") [发放月份] 一栏必须为数值!"
        Int_Count = Int_Count+1
    end if
    if (not (IsDate(Str_salary_date))) then
        Str_Mess  = Str_Mess +"\n"+ cstr(Int_Count) + ") [发放时间] 一栏必须为日期!"
        Int_Count = Int_Count+1
    end if
    if (not (IsNumeric(Str_employee_id))) then
        Str_Mess  = Str_Mess  +"\n"+ cstr(Int_Count) + ") [员工ID] 一栏必须为数值!"
        Int_Count = Int_Count+1
    end if
    if (Str_Mess<>"") then
        CheckData= "对不起,您录入的资料存在以下错误:" _
        +"\n"+ Str_Mess  _
        +"\n"+"\n"+"请检查资料或联系管理员!"
		call ShowMess(16,Str_Mess)
        call WindowBack()
    end if

%>
<HTML>
<HEAD>
    <META NAME="GENERATOR" CONTENT="WindSoft Programmer3">
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=gb2312">
    <TITLE>wh_salaries--维护</TITLE>
    <%
    dim mStr_WINDCallType
    mStr_WINDCallType = trim(request.querystring("WINDCallType"))       '调用方式
    dim mStr_WINDURL   '请将需要全局传递的变量链接到本变量上,使用方法参见WINDCallType,多个变量之间采用&链接
    mStr_WINDURL = "WINDCallType="+Server.URLEncode(mStr_WINDCallType)

    '下列为全局变量
    dim mStr_PK_salary_id                                   '主鍵
    dim mStr_salary_month                                   '发放月份
    dim mStr_salary_date                                    '发放时间
    %>
<script language="javascript" src="../pub/message1.js"></script>
</HEAD>
<BODY <%if salary_type=1 or salary_type=2 then response.write "onload='change_prizeurl(window.Frm_Update.employee_id)'"%> >
    <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">
        <TR>
            <TD>
                <FONT CLASS="locationhead">您的位置:</FONT>
                <A CLASS="locationdata" HREF="Main.asp?<% =mStr_WINDURL%>">工资管理</A>>>
                <A CLASS="locationlastdata" HREF="javascript:window.location.reload()">新增</A>
            </TD>
        </TR>
    </TABLE>
    <FORM ACTION="Post_Update.asp?<% =mStr_WINDURL%>" ID="Frm_Update" METHOD="post" name="Frm_Update">
        打<FONT COLOR=RED>**</FONT>的栏位为必须填写
        <TABLE WIDTH="100%" <% Response.write GetTableBorder()%>>
            <COLGROUP>
                <COL 1 CLASS="TABLEHEAD" WIDTH="100" ALIGN="RIGHT">
                <COL 1 CLASS="TABLEDATA">
            </COLGROUP>
            <TR>
                <TD>员工姓名&nbsp;</TD>
                <TD>&nbsp;
				<%=id2employee(request("employee_id"))%>
				<input type="hidden" name="employee_id" value="<%=request("employee_id")%>">
                </TD>
            </TR>

            <TR>
                <TD>发放月份&nbsp;</TD>
                <TD>&nbsp;
					<%=request("salary_month")&"月"%>
					<input type="hidden" name="salary_month" value="<%=request("salary_month")%>">
                </TD>
            </TR>
            <TR>
                <TD>发放时间&nbsp;</TD>
                <TD>&nbsp;
					<%=request("salary_dateYear")&"年"&request("salary_dateMonth")&"月"&request("salary_dateDay")&"日"%>
					<input type="hidden" name="salary_date" value="<%=request("salary_dateYear")&"-"&request("salary_dateMonth")&"-"&request("salary_dateDay")%>">
                    
                </TD>
            </TR>
<%
sql3="select top 1 salary_id from wh_salaries where employee_id="&request("employee_id")&" order by -salary_id"
set rs2=conn.execute (sql3)
if not rs2.eof then salary_id=rs2(0)
set rs2=nothing
%>
			<tr><td colspan="2" align="center" rowsbar>
				<iframe src="../view_salaries/Show2.asp?PK_salary_id=<%=salary_id%>&employee=<%=id2employee(request("employee_id"))%>" width="100%" scrolling="no"></iframe>
			</td></tr>

<%
i=1
set rs=conn.execute(sql1)
do while not rs.eof%>
	<TR>
		<TD><%=trim(rs("item1_name"))%>&nbsp;<INPUT TYPE="hidden" value="<%=trim(rs("item1_name"))&":"%>" NAME="plus_item<%=i%>"></TD>
		<TD>&nbsp;
		<INPUT STYLE="WIDTH:100px" NAME="plus<%=i%>"  
		style="font-size: 9pt; color: green" size="8" value='0'>
		<%if trim(rs("item1_name"))="项目奖励" then
			k=i%>
			[<span id="text001"><a href='javascript:openwin("<% = "getprize.asp?empid=" & request("employee_id")&"&itemid=plus"&i %>")'><font color=blue>奖金发放</font></a></span>]
		<%end if%>
		</TD>
	</TR>
<%
	i=i+1
	rs.movenext
loop
rs.close

j=1
set rs=conn.execute(sql2)
do while not rs.eof%>
	<TR>
		<TD><%=trim(rs("item2_name"))%>&nbsp;<INPUT TYPE="hidden" value="<%=trim(rs("item2_name"))&":"%>" NAME="minus_item<%=j%>"></TD>
		<TD>&nbsp;
		<INPUT STYLE="WIDTH:100px" NAME="minus<%=j%>"  
		style="font-size: 9pt; color: red" size="8" value='0'>
		<%if trim(rs("item2_name"))="个税" then%>
			[<A HREF="javascript:gettax();"><font color=blue>计算</font></A>]
		<%end if%>
		</TD>
	</TR>
<%
	j=j+1
	rs.movenext
loop
rs.close

session("plus")=i
session("minus")=j
%>
<TR>
                <TD>备注&nbsp;</TD>
                <TD>&nbsp;
                    <TEXTAREA STYLE="HEIGHT:100px;WIDTH:200px" NAME="salary_memo"> </TEXTAREA>
                </TD>
            </TR>
            <TR>
                <TD>是否发布&nbsp;</TD>
                <TD>&nbsp;
                    <SELECT NAME="salary_isopen">
					<OPTION VALUE='0'>暂不发布</OPTION>
					<OPTION VALUE='1'>发布</OPTION>
				</SELECT>	
                    <FONT COLOR=RED>**</FONT>
                </TD>
            </TR>
<tr STYLE="DISPLAY:NONE"><td><INPUT TYPE="text" NAME="salary_info1">
</td><td><INPUT TYPE="text" NAME="salary_info2">
</td></tr>
        </TABLE>
        <TABLE BORDER="0" WIDTH="80%">
            <TR>
                <TD>
                    <!--A HREF="#" ONCLICK="javascript:transdata();javascript:window.Frm_Update.submit();return false"><IMG SRC="../image/btok.gif" BORDER="0"></A-->
					<A IsShowProcessBar="True" ONCLICK="javascript:transdata();javascript:window.Frm_Update.submit();return false"><IMG SRC="../image/btok.gif" BORDER="0"></A>
                    <A HREF="#" ONCLICK="javascript:window.Frm_Update.reset();return false"><IMG SRC="../image/btno.gif" BORDER="0"></A>
                </TD>
                <TD ALIGN="RIGHT">
                    <% if (mStr_PK_salary_id="") then%>
                        <INPUT NAME="Continue" TYPE="checkbox" VALUE="1" <% if request.querystring("Continue")<>empty then Response.write "CHECKED"%>>
                        确定后继续增加资料
                    <% end if %>
                </TD>
            </TR>
        </TABLE>
        <DIV STYLE="DISPLAY:NONE">
            <INPUT TYPE="hidden" NAME="PK_salary_id" VALUE='<% Response.write mStr_PK_salary_id%>'>
        </DIV>
    </FORM> 
</BODY> 
</HTML> 

<script language="javascript">
function gettax()
{
	var plus;
	var minus;
	var pretax;
	var taxrate;
	var deduct;

	plus=0;
	minus=0;
<%for m=1 to i-1%>
	plus=plus+eval(Frm_Update.plus<%=m%>.value);
<%next%>
<%for n=1 to j-2%>
	minus=minus+eval(Frm_Update.minus<%=n%>.value);
<%next%>

	pretax=plus-minus-1000;
	if(pretax<0){
	  taxrate=0;
	  deduct=0;}
	if(pretax>=0 && pretax<500){
	  taxrate=0.05;
	  deduct=0;}
	if (pretax>=500 && pretax<2000){
	  taxrate=0.1;
	  deduct=25;}
	if (pretax>=2000 && pretax<5000){
	  taxrate=0.15;
	  deduct=125;}
	if (pretax>=5000 && pretax<20000){
	  taxrate=0.2;
	  deduct=375;}
	if (pretax>=20000 && pretax<40000){
	  taxrate=0.25;
	  deduct=1375;}
	if (pretax>=40000 && pretax<60000){
	  taxrate=0.3;
	  deduct=3375;}
	if (pretax>=60000 && pretax<80000){
	  taxrate=0.35;
	  deduct=6375;}
	if (pretax>=80000 && pretax<100000){
	  taxrate=0.4;
	  deduct=10375;}
	if (pretax>=100000){
	  taxrate=0.45;
	  deduct=15375;}
	Frm_Update.minus<%=j-1%>.value = (pretax*taxrate-deduct);

}

function transdata(){
	var salary_info1;
	var salary_info2;
<%for m=1 to i-1%>
	salary_info1=salary_info1+Frm_Update.plus_item<%=m%>.value+Frm_Update.plus<%=m%>.value+";";
<%next%>
<%for n=1 to j-1%>
	salary_info2=salary_info2+Frm_Update.minus_item<%=n%>.value+Frm_Update.minus<%=n%>.value+";";
<%next%>
	Frm_Update.salary_info1.value=salary_info1;
	Frm_Update.salary_info2.value=salary_info2;
}
</script>
<script LANGUAGE="JavaScript"> 
  <!-- 
  function openwin(url) { 
  window.open (url, "newwindow", "height=500, width=480, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no") //写成一行
  } 
  //--> 
</script>
<script language="vbscript">
function change_prizeurl(emp_id)
  text001.innerHTML = "<a href=javascript:openwin(""" + "getprize.asp?itemid=plus<%=k%>&empid=" + emp_id.value+""")>奖金发放</a>"
  'text001.innerHTML = "<a href=javascript:openwin(""" + "getprize.asp?itemid=plus<%=k%>&empid=1"+""")>奖金发放</a>"
end function
</script>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -