Functions.Execute("DataOperationYN",False,False,False)
Functions.Execute("LoadProgressInfo")
For Each fm As WinForm.Form In Forms
If fm.Name <> "片区欠费窗口" Then fm.Close()
Next
Tables("片区欠费窗口_Table1").StopRedraw()
Tables("片区欠费窗口_Table2").StopRedraw()
''''''
Dim ye As String = Nothing
If e.Form.Controls("rb-1").Checked Then
ye = " and [余额] < 0 "
ElseIf e.Form.Controls("rb1").Checked
ye = " and [余额] > 0 "
ElseIf e.Form.Controls("rb0").Checked
ye = " and [余额] = 0 "
Else
ye = ""
End If
Dim s3 As String = Nothing
Dim NdDr As DataRow = Nothing
Dim fName As String = Nothing
For Each nd As WinForm.TreeNode In e.Form.Controls("TreeView1").AllNodes
If nd.Checked Then
fName = nd.FullName
fName = fName.Replace("\",".")
NdDr = DataTables("dwZzjg").Find("级码 = '" & fName & "'" )
s3 &= "'" & NdDr("_Identify") & "',"
's3 &= "'" & nd.DataRow("_Identify") & "',"
End If
Next
If s3 Is Nothing Then
MessageBox.Show("请选择校区","提示",MessageBoxButtons.OK,MessageBoxIcon.Information )
Tables("片区欠费窗口_Table1").ResumeRedraw()
Tables("片区欠费窗口_Table2").ResumeRedraw()
Return
Else
s3 = s3.TrimEnd(",")
End If
Functions.Execute("LoadDatatableFalse","tbStudy","[学习校区Identify] in (" & s3 & ") " )
Dim dt As DataTable = DataTables("tbStudy")
Dim xhs As List(of String) = dt.GetValues("学号")
If xhs.Count = 0 Then
MessageBox.Show("人数为0","提示",MessageBoxButtons.OK,MessageBoxIcon.Information )
Tables("片区欠费窗口_Table1").ResumeRedraw()
Tables("片区欠费窗口_Table2").ResumeRedraw()
Return
End If
Dim jb As New SQLJoinTableBuilder("校区片区欠费统计表","tbStudy")
jb.ConnectionName = connName
jb.AddTable("tbStudy","学号","tbStudentInfo","学号")
jb.AddCols("{tbStudentInfo}.学号","{tbStudentInfo}.姓名","拼音","性别","学校","届次","{tbStudentInfo}.班级","第一联系","第二联系","第三联系","期次")
Dim sfilter As String = Nothing
For Each s As String In xhs
sfilter &= "'" & s & "',"
Next
sfilter = sfilter.TrimEnd(",")
jb.Filter = "[学习校区Identify] in (" & s3 & ") " & " And {tbStudentInfo}.学号 In (" & sfilter & ")"
jb.Distinct = True
'jb.Build()
'With Tables("校区片区欠费统计表")
With Tables("片区欠费窗口_Table1")
.DataSource = jb.BuildDataSource
'.StopRedraw()
If .Cols.Contains("所报课程") = False Then .DataTable.DataCols.Add("所报课程",Gettype(String),500)
If .Cols.Contains("应交学费") = False Then .DataTable.DataCols.Add("应交学费",Gettype(Double))
If .Cols.Contains("实交学费") = False Then .DataTable.DataCols.Add("实交学费",Gettype(Double))
If .Cols.Contains("折扣金额") = False Then .DataTable.DataCols.Add("折扣金额",Gettype(Double))
If .Cols.Contains("优惠金额") = False Then .DataTable.DataCols.Add("优惠金额",Gettype(Double))
If .Cols.Contains("欠费金额") = False Then .DataTable.DataCols.Add("欠费金额",Gettype(Double))
If .Rows.Count > 0 Then
Dim drs As List(of DataRow) = Nothing
Dim s As String = Nothing
Dim qcs As List(of String) = Nothing
For Each r As Row In .Rows
drs = dt.Select("学号 = '" & r("学号") & "' and 期次 = '" & r("期次") & "' And 状态 in ('正常','试听') " & ye)
s = Nothing
For Each dr As DataRow In drs
s &= dr("课程") & ","
Next
s = s.TrimEnd(",")
r("所报课程") = s
r("应交学费") = dt.Compute("sum(应交学费)","学号 = '" & r("学号") & "' and 期次 = '" & r("期次") & "' And 状态 in ('正常','试听') " & ye)
r("实交学费") = dt.Compute("sum(实交学费)","学号 = '" & r("学号") & "' and 期次 = '" & r("期次") & "' And 状态 in ('正常','试听') " & ye)
r("折扣金额") = dt.Compute("sum(折扣金额)","学号 = '" & r("学号") & "' and 期次 = '" & r("期次") & "' And 状态 in ('正常','试听') " & ye)
r("优惠金额") = dt.Compute("sum(优惠金额)","学号 = '" & r("学号") & "' and 期次 = '" & r("期次") & "' And 状态 in ('正常','试听') " & ye)
r("欠费金额") = dt.Compute("sum(余额)","学号 = '" & r("学号") & "' and 期次 = '" & r("期次") & "' And 状态 in ('正常','试听') " & ye)
Next
End If
.AutoSizeCols()
.Sort = "届次,学校,班级"
.Cols("拼音").Visible = False
.AllowEdit = False
'.ResumeRedraw()
.Grid.AllowFiltering = True
.Grid.AllowFreezing = True
End With
''''''
'StatusBar.Message1 = "共有【" & Tables("校区片区欠费统计表").Rows.Count & "】条学生缴费信息"
StatusBar.Message1 = "共有【" & Tables("片区欠费窗口_Table1").Rows.Count & "】条学生缴费信息"
With Tables("片区欠费窗口_Table1")
'.DataSource = DataTables("校区片区欠费统计表")
'Tables("片区欠费窗口_Table1").ResumeRedraw()
.ResumeRedraw
.Grid.AllowFiltering = True
.AllowEdit = False
.Cols("应交学费").GrandTotal = True
.Cols("实交学费").GrandTotal = True
.Cols("折扣金额").GrandTotal = True
.Cols("优惠金额").GrandTotal = True
.Cols("欠费金额").GrandTotal = True
.GrandTotal = True
.AutoSizeCols()
End With
With Tables("片区欠费窗口_Table2")
.ResumeRedraw()
End With
Functions.Execute("TableStyle","片区欠费窗口_Table1")
Functions.Execute("TableStyle","片区欠费窗口_Table2")