?? main.asp
字號(hào):
<%@ Language=VBScript %>
<%
'文件功能:工資管理---主界面
'版權(quán)所有:萬(wàn)戶網(wǎng)絡(luò)
'編寫(xiě)人員:房鵬
'編寫(xiě)時(shí)間:2003-8-12
'修改人員:房鵬
'修改時(shí)間:2003-8-13,2003-8-22
'修改目的:設(shè)立權(quán)限控制,重寫(xiě)取值方式
%>
<!-- #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
%>
<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")) '調(diào)用方式
dim mStr_WINDURL '請(qǐng)將需要全局傳遞的變量鏈接到本變量上,使用方法參見(jiàn)WINDCallType,多個(gè)變量之間采用&鏈接
mStr_WINDURL = "WINDCallType="+Server.URLEncode(mStr_WINDCallType)
dim mInt_Page '當(dāng)前頁(yè)
dim mInt_RecordCount '總記錄數(shù)
dim mInt_CountPerPage '每頁(yè)記錄數(shù)
dim mStr_SortBy '排序方式
dim mStr_AscMark '排列順序
dim mStr_salary_date '工資發(fā)放時(shí)間
dim mStr_salary_month '月份
dim mStr_employee_id 'employee_id
dim mStr_salary_info1 '加
dim mStr_salary_info2 '減
dim mStr_salary_isopen '是否發(fā)布
call InitData()
%>
<script LANGUAGE="JavaScript">
function openwin(url) {
window.open(url, '', "height=150, width=750, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no"); //寫(xiě)成一行
}
</script>
<script language="javascript" src="../pub/message2.js"></script>
</HEAD>
<BODY>
<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="Main.asp?<% =mStr_WINDURL%>">主界面</A>
</TD>
</TR>
</TABLE>
<FORM ID="Frm_Data" NAME="Frm_Data">
<TABLE BORDER="0" WIDTH="100%">
<TR>
<TD ALIGN="LEFT" WIDTH=33%>
<A HREF="javascript:SelectAll()">全選</A>
<A HREF="javascript:SelectReverse()">反選</A>
</TD>
<TD ALIGN="RIGHT">
<A HREF="Update_select.asp?<% =mStr_WINDURL%>">新增</A>
<A HREF="javascript:CallUpdate()" IsShowProcessBar="True">修改</A>
<A HREF="javascript:CallDelete()">刪除</A>
<A HREF="javascript:WindowPrint()">打印</A>
<A HREF="Search.asp?<% =mStr_WINDURL%>">查詢</A>
</TD>
</TR>
</TABLE>
<TABLE WIDTH=100% <% Response.write GetTableBorder()%>>
<COLGROUP>
<COL 1 WIDTH="40" ALIGN="CENTER">
<COL 2 WIDTH="40" ALIGN="CENTER">
</COLGROUP>
<TR CLASS='TABLEHEAD' ALIGN=CENTER>
<TD>選擇</TD>
<TD>序號(hào)</TD>
<TD><A HREF='javascript:OrderBy("salary_date")'>工資發(fā)放時(shí)間<% call GetOrderBy("salary_date")%></A></TD>
<TD><A HREF='javascript:OrderBy("salary_month")'>月份<% call GetOrderBy("salary_month")%></A></TD>
<TD><A HREF='javascript:OrderBy("employee_id")'>員工姓名<% call GetOrderBy("employee_id")%></A></TD>
<TD><A HREF='javascript:OrderBy("salary_memo")'>備注<% call GetOrderBy("salary_memo")%></A></TD>
</TR>
<%
call ShowAllData_wh_salaries() '顯示查詢結(jié)果
%>
</TABLE>
<%
'顯示頁(yè)數(shù)
call ShowPage(mInt_RecordCount,mInt_CountPerPage,mInt_Page,"WIDTH:100%")
%>
</FORM>
<DIV STYLE="DISPLAY:NONE">
<FORM ACTION="?<% =mStr_WINDURL%>" ID="Frm_Update" METHOD="post">
<INPUT NAME="Page" id=Page VALUE='<% =mInt_Page %>'>
<INPUT NAME="SortBy" id=SortBy VALUE='<% =mStr_SortBy %>'>
<INPUT NAME="AscMark" id=AscMark VALUE='<% =mStr_AscMark %>'>
<INPUT NAME='salary_date' VALUE='<% =mStr_salary_date %>'>
<INPUT NAME='salary_month' VALUE='<% =mStr_salary_month %>'>
<INPUT NAME='employee_id' VALUE='<% =mStr_employee_id %>'>
<INPUT NAME='salary_info1' VALUE='<% =mStr_salary_info1 %>'>
<INPUT NAME='salary_info2' VALUE='<% =mStr_salary_info2 %>'>
</FORM>
</DIV>
</BODY>
</HTML>
<%
function InitData()
'初始化
dim Str_Mess '錯(cuò)誤信息
dim Int_Count '錯(cuò)誤記錄數(shù)
'讀取查詢條件
mInt_Page = val(trim(request.form("Page")))
if mInt_Page=0 then mInt_Page=Val(session("session_wh_salariesPage"))
if mInt_Page=0 then mInt_Page=1
session("session_wh_salariesPage")=mInt_Page
mStr_SortBy = trim(request.form("SortBy"))
mStr_AscMark = trim(request.form("AscMark"))
mStr_salary_date = trim(request.form("salary_date"))
mStr_salary_month = trim(request.form("salary_month"))
mStr_employee_id = trim(request.form("employee_id"))
mStr_salary_info1 = trim(request.form("salary_info1"))
mStr_salary_info2 = trim(request.form("salary_info2"))
Str_Mess = ""
Int_Count = 1
if ((mStr_salary_date<>"") and not (IsDate(mStr_salary_date))) then
Str_Mess = Str_Mess + "\n" + cstr(Int_Count) + ") [工資發(fā)放時(shí)間] 一欄必須為日期!"
Int_Count = Int_Count+1
end if
if ((mStr_salary_month<>"") and not (IsNumeric(mStr_salary_month))) then
Str_Mess = Str_Mess + "\n" + cstr(Int_Count) + ") [月份] 一欄必須為數(shù)值!"
Int_Count = Int_Count+1
end if
if ((mStr_employee_id<>"") and not (IsNumeric(mStr_employee_id))) then
Str_Mess = Str_Mess + "\n" + cstr(Int_Count) + ") [employee_id] 一欄必須為數(shù)值!"
Int_Count = Int_Count+1
end if
if (Str_Mess<>"") then
call ShowMess(16,"對(duì)不起,您錄入的資料存在以下錯(cuò)誤:" _
+"\n"++"\n"+ "請(qǐng)檢查資料或聯(lián)系管理員!")
call WindowBack()
end if
end function
function ShowAllData_wh_salaries()
'顯示查詢結(jié)果
dim Str_PK_salary_id '主鍵
dim Str_salary_date '工資發(fā)放時(shí)間
dim Str_salary_month '月份
dim Str_employee_id 'employee_id
dim Str_salary_info1 '加
dim Str_salary_info2 '減
dim Str_salary_isopen '是否發(fā)布
dim Rec_Data '結(jié)果集
dim Int_PageCount '總頁(yè)數(shù)
dim Int_Count '記數(shù)
mInt_CountPerPage = GetCountPerPage()
'計(jì)算頁(yè)數(shù)
set Rec_Data = mCls_wh_salaries.SearchData(mStr_SortBy + " "+ mStr_AscMark, mStr_salary_date, mStr_salary_month, mStr_employee_id, mStr_salary_info1, mStr_salary_info2)
mInt_RecordCount = Rec_Data.RecordCount
if not Rec_Data.eof then
Rec_Data.PageSize = mInt_CountPerPage
Int_PageCount = Rec_Data.PageCount
if mInt_Page > Int_PageCount then mInt_Page=1
Rec_Data.AbsolutePage = mInt_Page
end if
Int_Count = 0
Do while not Rec_Data.eof and Int_Count<mInt_CountPerPage
'讀取資料
Int_Count = Int_Count+1
Str_PK_salary_id = Server.HTMLEncode(trim(Rec_Data.fields("salary_id") & ""))
Str_salary_date = Server.HTMLEncode(trim(Rec_Data.fields("salary_date") & ""))
Str_salary_month = Server.HTMLEncode(trim(Rec_Data.fields("salary_month") & ""))
Str_employee_id = Server.HTMLEncode(trim(Rec_Data.fields("employee_id") & ""))
Str_salary_info1 = Server.HTMLEncode(trim(Rec_Data.fields("salary_info1") & ""))
Str_salary_info2 = Server.HTMLEncode(trim(Rec_Data.fields("salary_info2") & ""))
Str_salary_isopen = Server.HTMLEncode(trim(Rec_Data.fields("salary_isopen") & ""))
Str_salary_memo = Server.HTMLEncode(trim(Rec_Data.fields("salary_memo") & ""))
Str_salary_memo = replace(Str_salary_memo,vbCrlf,"<BR> ")
Str_salary_info1 = replace(Str_salary_info1,vbCrlf,"<BR> ")
Str_salary_info2 = replace(Str_salary_info2,vbCrlf,"<BR> ")
'顯示資料
%>
<!-- #include file="../wh_salaries/Show_wh_salaries.asp" -->
<%
Rec_Data.movenext
loop
Rec_Data.close
end function
function GetOrderBy(pStr_SortBy)
if (mStr_SortBy = pStr_SortBy) then
if (mStr_AscMark = "") then
Response.Write "<img src='../image/btup.gif' ALIGN='ABSMIDDLE' BORDER=0>"
else
Response.Write "<img src='../image/btdown.gif' ALIGN='ABSMIDDLE' BORDER=0>"
end if
end if
end function
%>
<SCRIPT LANGUAGE="javascript">
<!--********************************************************************************-->
function getpage(pStr_Page){
//換頁(yè)
window.Frm_Update.Page.value=pStr_Page;
window.Frm_Update.submit()
}
<!--********************************************************************************-->
function OrderBy(pStr_Type){
//排序
window.Frm_Update.SortBy.value=pStr_Type;
if (pStr_Type=="<% =mStr_SortBy%>"){
window.Frm_Update.AscMark.value=(window.Frm_Update.AscMark.value==""?"desc":"")
} else {
window.Frm_Update.AscMark.value=""
}
window.Frm_Update.Page.value=1;
window.Frm_Update.submit()
}
<!--********************************************************************************-->
function SelectAll(){
//全選
var Int_Count
var Int_I
Int_Count=window.Frm_Data.length
for(Int_I=0; Int_I<=Int_Count-1; Int_I++){
if (document.Frm_Data.elements[Int_I].name=="ChkID"){
document.Frm_Data.elements[Int_I].checked=true
}
}
}
<!--********************************************************************************-->
function SelectReverse(){
//反選
var Int_Count
var Int_I
var Str_Var
Int_Count=window.Frm_Data.length
for(Int_I=0; Int_I<=Int_Count-1; Int_I++){
if (document.Frm_Data.elements[Int_I].name=="ChkID"){
Str_Var=document.Frm_Data.elements[Int_I].checked
document.Frm_Data.elements[Int_I].checked=! Str_Var
}
}
}
<!--********************************************************************************-->
function CallUpdate(){
//修改資料
var Int_SelectCount
var Str_ChkID
var Int_Len
var Str_Date=new Date()
Int_SelectCount=GetSelectCount()
Str_ChkID=GetSelected()
if (Int_SelectCount<=0){
alert("對(duì)不起,請(qǐng)選擇要修改的 [wh_salaries]!")
return
}
if (Int_SelectCount>1){
alert("對(duì)不起,您只能選擇一個(gè)要修改的 [wh_salaries]!")
return
}
Int_Len=Str_ChkID.length
if (Str_ChkID!="") {Str_ChkID=Str_ChkID.substr(1,Int_Len-2)}
window.location="edit.asp?<% =mStr_WINDURL%>&time="+Str_Date.getTime()+"&PK_salary_id="+Str_ChkID
}
<!--********************************************************************************-->
function CallDelete(){
//刪除資料
var Int_SelectCount
var Str_ChkID
var Str_Date=new Date()
Int_SelectCount=GetSelectCount()
Str_ChkID=GetSelected()
if (Int_SelectCount<=0){
alert("對(duì)不起,請(qǐng)選擇要?jiǎng)h除的 [wh_salaries]!")
return
}
if (window.confirm("刪除選定的 [wh_salaries]嗎?")){
window.location="Delete.asp?<% =mStr_WINDURL%>&time="+Str_Date.getTime()+"&PK_salary_id="+Str_ChkID
}
}
<!--********************************************************************************-->
function GetSelectCount(){
//讀取選定的編碼
var Int_Count
var Int_SelectCount
var Str_Chk
var Str_ChkID
var Int_I
var Str_Value
Str_ChkID=""
Int_Count=window.Frm_Data.length
Int_SelectCount=0
for(Int_I=0; Int_I<=Int_Count-1; Int_I++){
if (document.Frm_Data.elements[Int_I].name=="ChkID"){
Str_Value=document.Frm_Data.elements[Int_I].value
if ((Str_Value!="") && (document.Frm_Data.elements[Int_I].checked)){
Int_SelectCount=Int_SelectCount+1
}
}
}
return Int_SelectCount
}
<!--********************************************************************************-->
function GetSelected(){
//讀取選定的編碼
var Int_Count
var Int_SelectCount
var Str_Chk
var Str_ChkID
var Int_I
var Str_Value
Str_ChkID=""
Int_Count=window.Frm_Data.length
Int_SelectCount=0
for(Int_I=0; Int_I<=Int_Count-1; Int_I++){
if (document.Frm_Data.elements[Int_I].name=="ChkID"){
Str_Value=document.Frm_Data.elements[Int_I].value
if ((Str_Value!="") && (document.Frm_Data.elements[Int_I].checked)){
Int_SelectCount=Int_SelectCount+1;
Str_ChkID=Str_ChkID +",'"+Str_Value+"'";
}
}
}
if (Str_ChkID!="") {Str_ChkID=Str_ChkID.substr(1)}
return Str_ChkID
}
<!--********************************************************************************-->
</SCRIPT>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -