以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  高手指点  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=31996)

--  作者:良才
--  发布时间:2013/4/24 9:36:00
--  高手指点


图片点击可在新窗口打开查看此主题相关图片如下:教师课时安排.png
图片点击可在新窗口打开查看

图片点击可在新窗口打开查看此主题相关图片如下:班级人数.png
图片点击可在新窗口打开查看

图片点击可在新窗口打开查看此主题相关图片如下:班级超人数奖励.png
图片点击可在新窗口打开查看


班级人数表 班级人数列 * 教师课时安排表 语文课时列(语文课时列不是为空看作1)- 班级人数表 规定人数=班级超人数奖励表 班级超人数,把教师课时安排表 语文课时列不是为空 看作1  ,请高手指点

按钮代码:

 

DataTables("班级超人数奖励").DataRows.Clear()
For Each dr1 As DataRow In DataTables("班级人数").DataRows
    For Each dr2 As DataRow In DataTables("教师课时安排").Select("[学期] = \'" & dr1("学期") & "\' and [班级] =\'" & dr1("班级") & "\'")
      Dim nm As String = dr2("学期")
        Dim vl As Integer = dr1("班级人数")*?
        If dic.ContainsKey(nm) = False
            dic.Add(nm,vl)
        Else
            dic(nm) = dic(nm)+ vl
        End If
    Next
Next
For Each key As String In dic.keys
    Dim dr As DataRow = DataTables("班级超人数奖励").AddNew()
    dr("学期") = key
    dr("班级超人数") = dic(key)
Next

Dim dic1 As new Dictionary(of String,Integer)
DataTables("班级超人数奖励").DataRows.Clear()
For Each dr1 As DataRow In DataTables("班级人数").DataRows
    For Each dr2 As DataRow In DataTables("教师课时安排").Select("[学期] = \'" & dr1("学期") & "\' and [班级] =\'" & dr1("班级") & "\'")
        Dim nm1 As String = dr2("教工姓名")
        Dim vl As Integer = dr1("班级人数")*?
        If dic1.ContainsKey(nm1 & "|" & dr2("学期")) = False
            dic1.Add(nm1 & "|" & dr2("学期"),vl)
        Else
            dic1(nm1 & "|" & dr2("学期")) = dic1(nm1 & "|" & dr2("学期"))+ vl
        End If
    Next
Next
For Each key As String In dic1.keys
    Dim dr1 As DataRow = DataTables("班级超人数奖励").AddNew()
    Dim str() As String = key.Split("|")
    dr1("教工姓名") = str(0)
    dr1("学期")=str(1)
    dr1("班级超人数") = dic1(key)
Next

[此贴子已经被作者于2013-4-24 11:02:46编辑过]