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

📄 cls_view_tech_bonus2.asp

📁 这是一个自己研发的薪酬管理系统
💻 ASP
字号:
<%
'文件功能:view_tech_bonus2--数据逻辑(商业层)
'编写人员:阿房
'编写时间:2003-08-18 14:39:32
'开发平台:ASP3.0 + MSSQL2000

%>

<%
Class Cls_view_tech_bonus2
    '********************************************************************************************
    function SaveData(pStr_PK_tbonus_id, pStr_project_name, pStr_employee_name, pStr_tbonus_fprize, pStr_tbonus_fisgive, pStr_tbonus_fdate, pStr_tbonus_lprize, pStr_tbonus_lisgive, pStr_tbonus_ldate, pStr_employee_id, pStr_project_id, pStr_tbonus_id)
    '功能:存储详细数据
    '参数:详细数据集合
    '返回:错误信息或空
    dim Str_ID                           '系统编码
    dim Str_Sql                          'SQL语句
        Str_ID = trim(pStr_PK_tbonus_id)
    
        if isdate(pStr_tbonus_fdate) then
            pStr_tbonus_fdate = "'" + FormatDate(pStr_tbonus_fdate,"yyyy-mm-dd hh:nn:ss") + "'"
        else
            pStr_tbonus_fdate = "null"
        end if
        if isdate(pStr_tbonus_ldate) then
            pStr_tbonus_ldate = "'" + FormatDate(pStr_tbonus_ldate,"yyyy-mm-dd hh:nn:ss") + "'"
        else
            pStr_tbonus_ldate = "null"
        end if
    
        if (Str_ID = "") then
    
            Str_Sql =  "insert into view_tech_bonus2 (" _
            + vbCrlf + "   project_name" _
            + vbCrlf + "  ,employee_name" _
            + vbCrlf + "  ,tbonus_fprize" _
            + vbCrlf + "  ,tbonus_fisgive" _
            + vbCrlf + "  ,tbonus_fdate" _
            + vbCrlf + "  ,tbonus_lprize" _
            + vbCrlf + "  ,tbonus_lisgive" _
            + vbCrlf + "  ,tbonus_ldate" _
            + vbCrlf + "  ,employee_id" _
            + vbCrlf + "  ,project_id" _
            + vbCrlf + "  ,tbonus_id" _
            + vbCrlf + "   )"
            Str_Sql = Str_Sql _
            + vbCrlf + " values (" _
            + vbCrlf + "   '" + ConvertSql(pStr_project_name) + "'" _
            + vbCrlf + "  ,'" + ConvertSql(pStr_employee_name) + "'" _
            + vbCrlf + "  ,0" + cstr(Val(pStr_tbonus_fprize)) + "" _
            + vbCrlf + "  ,'" + ConvertSql(pStr_tbonus_fisgive) + "'" _
            + vbCrlf + "  , " +(pStr_tbonus_fdate) + "" _
            + vbCrlf + "  ,0" + cstr(Val(pStr_tbonus_lprize)) + "" _
            + vbCrlf + "  ,'" + ConvertSql(pStr_tbonus_lisgive) + "'" _
            + vbCrlf + "  , " +(pStr_tbonus_ldate) + "" _
            + vbCrlf + "  ,0" + cstr(Val(pStr_employee_id)) + "" _
            + vbCrlf + "  ,0" + cstr(Val(pStr_project_id)) + "" _
            + vbCrlf + "  ,0" + cstr(Val(pStr_tbonus_id)) + "" _
            + vbCrlf + "   )"
                     
        else
            Str_Sql =  "Update view_tech_bonus2 Set" _
            + vbCrlf + "   project_name='" + ConvertSql(pStr_project_name) + "'" _
            + vbCrlf + "  ,employee_name='" + ConvertSql(pStr_employee_name) + "'" _
            + vbCrlf + "  ,tbonus_fprize=0" + cstr(Val(pStr_tbonus_fprize)) + "" _
            + vbCrlf + "  ,tbonus_fisgive='" + ConvertSql(pStr_tbonus_fisgive) + "'" _
            + vbCrlf + "  ,tbonus_fdate=" +(pStr_tbonus_fdate) + "" _
            + vbCrlf + "  ,tbonus_lprize=0" + cstr(Val(pStr_tbonus_lprize)) + "" _
            + vbCrlf + "  ,tbonus_lisgive='" + ConvertSql(pStr_tbonus_lisgive) + "'" _
            + vbCrlf + "  ,tbonus_ldate=" +(pStr_tbonus_ldate) + "" _
            + vbCrlf + "  ,employee_id=0" + cstr(Val(pStr_employee_id)) + "" _
            + vbCrlf + "  ,project_id=0" + cstr(Val(pStr_project_id)) + "" _
            + vbCrlf + "  ,tbonus_id=0" + cstr(Val(pStr_tbonus_id)) + "" _
            + vbCrlf + "   Where tbonus_id='" + ConvertSql(Str_ID) + "'"
        end if
        
        'response.write str_sql
        'response.end
        if (not gCls_DbProcess2.ExecuteSQL(Str_Sql)) then
            SaveData = GetUpdateErrMSG
        else
            SaveData = ""
        end if
    end function
    '********************************************************************************************
    function GetData(pStr_PK_tbonus_id)
    '功能:读取详细数据
    '参数:数据系统编码
    '返回:详细数据
    dim Str_Sql                          'SQL语句
    dim Rec_Data                         '结果集
        Str_Sql =  "select *" _
        + vbCrlf + "   from view_tech_bonus2" _
        + vbCrlf + "   where tbonus_id = '" + ConvertSql(pStr_PK_tbonus_id) + "'"
        'response.write str_sql
        'response.end
        call gCls_DbProcess2.RunSQLSearch(Str_Sql,Rec_Data)
        set GetData = Rec_Data
    end function
    '********************************************************************************************
    function SearchData(pStr_OrderBy, pStr_project_name, pStr_employee_name, pStr_tbonus_fprize, pStr_tbonus_fisgive, pStr_tbonus_fdate, pStr_tbonus_lprize, pStr_tbonus_lisgive, pStr_tbonus_ldate, pStr_employee_id, pStr_project_id, pStr_tbonus_id)
    '功能:查询资料
    '参数:查询条件
    '返回:查询结果
    dim Str_Sql                          'SQL语句
    dim Rec_Data                         '结果集
        Str_Sql="1=1 and employee_id="&empid
    
    
        if trim(pStr_project_name) <> "" then
            Str_Sql = Str_Sql + vbCrlf + " and project_name like '%" + ConvertSql(pStr_project_name) + "%'"
        end if
    
        if trim(pStr_employee_name) <> "" then
            Str_Sql = Str_Sql + vbCrlf + " and employee_name like '%" + ConvertSql(pStr_employee_name) + "%'"
        end if
    
        if isnumeric(pStr_tbonus_fprize) then
            Str_Sql=Str_Sql + vbCrlf + " and tbonus_fprize = 0" + cstr(Val(pStr_tbonus_fprize)) + ""
        end if
    
        if trim(pStr_tbonus_fisgive) <> "" then
            Str_Sql = Str_Sql + vbCrlf + " and tbonus_fisgive like '%" + ConvertSql(pStr_tbonus_fisgive) + "%'"
        end if
    
        if isdate(pStr_tbonus_fdate) then
            Str_Sql = Str_Sql + vbCrlf + " and datediff(d,tbonus_fdate,'" + FormatDate(pStr_tbonus_fdate,"yyyy-mm-dd") + "')=0"
            'ACCESS
            'Str_Sql = Str_Sql + vbCrlf + " and datediff('d',tbonus_fdate,'" + FormatDate(pStr_tbonus_fdate,"yyyy-mm-dd") + "')=0"
        end if
    
        if isnumeric(pStr_tbonus_lprize) then
            Str_Sql=Str_Sql + vbCrlf + " and tbonus_lprize = 0" + cstr(Val(pStr_tbonus_lprize)) + ""
        end if
    
        if trim(pStr_tbonus_lisgive) <> "" then
            Str_Sql = Str_Sql + vbCrlf + " and tbonus_lisgive like '%" + ConvertSql(pStr_tbonus_lisgive) + "%'"
        end if
    
        if isdate(pStr_tbonus_ldate) then
            Str_Sql = Str_Sql + vbCrlf + " and datediff(d,tbonus_ldate,'" + FormatDate(pStr_tbonus_ldate,"yyyy-mm-dd") + "')=0"
            'ACCESS
            'Str_Sql = Str_Sql + vbCrlf + " and datediff('d',tbonus_ldate,'" + FormatDate(pStr_tbonus_ldate,"yyyy-mm-dd") + "')=0"
        end if
    
        if isnumeric(pStr_employee_id) then
            Str_Sql=Str_Sql + vbCrlf + " and employee_id = 0" + cstr(Val(pStr_employee_id)) + ""
        end if
    
        if isnumeric(pStr_project_id) then
            Str_Sql=Str_Sql + vbCrlf + " and project_id = 0" + cstr(Val(pStr_project_id)) + ""
        end if
    
        if isnumeric(pStr_tbonus_id) then
            Str_Sql=Str_Sql + vbCrlf + " and tbonus_id = 0" + cstr(Val(pStr_tbonus_id)) + ""
        end if
    
        '排序处理
        if trim(pStr_OrderBy) = "" then
             pStr_OrderBy = "project_name"
        end if
    
        Str_Sql =  "select *" _
        + vbCrlf + "   from view_tech_bonus2" _
        + vbCrlf + "   where " + Str_Sql  _
        + vbCrlf + "   order by " + pStr_OrderBy
        'response.write str_sql
        'response.end
        call gCls_DbProcess2.RunSQLSearch(Str_Sql,Rec_Data)
        set SearchData = Rec_Data
    end function
    '********************************************************************************************
    function DeleteData(pStr_PK_tbonus_id)
    '功能:删除资料
    '参数:系统编码集合(如 'A01','A02','A03')
    '返回:错误信息或空
    dim Str_ID                       '编码集合
    dim Str_Sql                      'SQL语句
        Str_ID  = trim(pStr_PK_tbonus_id)
        if (Str_ID = "") then Str_ID ="''"
        if IsUsed(Str_ID) then 
            DeleteData = GetDeleteErrMSG
            exit function
        end if
        
        Str_Sql =  "delete from view_tech_bonus2" _
        + vbCrlf + "   Where tbonus_id in (" + Str_ID + ")"
        'response.write str_sql
        'response.end
        if (not gCls_DbProcess2.ExecuteSQL(Str_Sql)) then
            DeleteData = GetDeleteErrMSG
        else
            DeleteData = ""
        end if
    end function
    '********************************************************************************************
    function Count()
    '功能:查询数据记录总数
    '参数:无
    '返回:记录总数
    dim Rec_Data                        '结果集
    dim Int_Count                       '记数
    dim Str_Sql                         'SQL语句
        Str_Sql =  "select count(*) as allcount" _
        + vbCrlf + "   from view_tech_bonus2"
        'response.write str_sql
        'response.end
        call gCls_DbProcess2.RunSQLSearch(Str_Sql,Rec_Data)
        if (Rec_Data.eof) then
            Int_Count = 0
        else
            Int_Count = Val(Rec_Data.fields("allcount") & "")
        end if
        Rec_Data.close
        Count = Int_Count
    end function
    '********************************************************************************************
    function IsUsed(pStr_PK_tbonus_id)
    '功能:数据是否已开始使用
    '参数:系统编码集合
    '返回:是否使用
    dim Rec_Data                          '结果集
    dim Int_Count                         '记数
    dim Str_Sql                           'SQL语句
    dim Str_ID
        Str_ID     = trim(pStr_PK_tbonus_id)       '编码集合
        if (Str_ID = "") then Str_ID="''"
        '本句需要根据实际情况进行调整
        Str_Sql  = "select count(*) as allcount" _
        + vbCrlf + "   from view_tech_bonus2" _
        + vbCrlf + "   where 1=2"
        'response.write str_sql
        'response.end
        call gCls_DbProcess2.RunSQLSearch(Str_Sql,Rec_Data)
        if (Rec_Data.eof) then
            Int_Count = 0
        else
            Int_Count = Val(Rec_Data.fields("allcount") & "")
        end if
        Rec_Data.Close
        if (Int_Count>0) then
            IsUsed = true
        else
            IsUsed = false
        end if
    end function
    '********************************************************************************************
    function IsExist(pStr_PK_tbonus_id)
    '功能:数据是否存在
    '参数:系统编码集合
    '返回:是否存在
    dim Rec_Data                          '结果集
    dim Str_Data
    dim Int_Count1                        '记数
    dim Int_Count                         '记数
    dim Str_Sql                           'SQL语句
    dim Str_ID
        Str_ID     = trim(pStr_PK_tbonus_id)       '编码集合
        if (Str_ID = "") then Str_ID="''"
        '本句需要根据实际情况进行调整
        Str_Sql =  "select count(*) as allcount" _
        + vbCrlf + "   from view_tech_bonus2" _
        + vbCrlf + "  where tbonus_id in ("+Str_ID+")"
        'response.write str_sql
        'response.end
        call gCls_DbProcess2.RunSQLSearch(Str_Sql,Rec_Data)
        if (Rec_Data.eof) then
            Int_Count = 0
        else
            Int_Count = Val(Rec_Data.fields("allcount") & "")
        end if
        Rec_Data.Close
        Str_Data = split(cstr(Str_ID),",")
        Int_Count1 = ubound(Str_Data)+1
        if (Int_Count=Int_Count1) then
            IsExist = true
        else
            IsExist = false
        end if
    end function
    '********************************************************************************************
end Class

dim mCls_view_tech_bonus2
set mCls_view_tech_bonus2 = new Cls_view_tech_bonus2
%>

⌨️ 快捷键说明

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