说明:出生表中有单位,从出生表中得到村级单位,年,月,从超龄妇女表中得到出生日期或者输入一个日期,然后统计的时候定义条件时大于这个日期即可,根据这些选择生成本月的报表,求老师帮我修改下代码,我搞的乱了,谢谢
Dim village As WinForm.ComboBox = e.Form.Controls("村级单位")
village.Combolist = DataTables("出生").GetCombolistString("单位名称")
Dim name As String = MainTable.Name
If name.Contains("村级一览表") Then
Dim dt As DataTable = DataTables("出生")
Dim y,m As Integer
y = name.Replace("村级表","").Replace("月","").Split("年")(0)
m = name.Replace("村级表","").Replace("月","").Split("年")(1)
Dim d As Date = New Date(y,m,1)
Dim d1 As Date = New Date(y,m,Date.DaysInMonth(y,m))
MainTable.DataTable.DataRows.Clear
Dim dr As List(Of DataRow) = DataTables("出生").Select("单位名称 = '" & village.Text & "'")
Dim arys As List(Of String()) = dt.GetUniqueValues("", "单位名称", "组名称")
For Each ary As String() In arys
Dim r As Row = MainTable.AddNew
r("单位") = ary(0)
r("组名称") = ary(1)
Dim filter As String = "单位名称 = '" & ary(0) & "' And 组名称 = '" & ary(1) & "'"
r("总人口数") = DataTables("总人口").Compute("Count(_Identify)", filter & " And 出生日期 <= #" & d1 & "#") - DataTables("迁入").Compute("Count(_Identify)", filter & " And 变动日期 > #" & d1 & "#") + DataTables("迁出").Compute("Count(_Identify)", filter & " And 迁出日期 > #" & d1 & "#") + DataTables("死亡").Compute("Count(_Identify)", filter & " And 死亡日期 > #" & d1 & "#")
r("出生_总数") = dt.Compute("Count(_Identify)", filter & " And 子女出生日期 >= #" & d & "# And 子女出生日期 <= #" & d1 & "#")
此主题相关图片如下:2.jpg
此主题相关图片如下:未命名.jpg