Dim str As String = CurrentTable.Current("科目代码")
e.Form.Controls("Label9").text = str '科目代码
str = str.SubString(0,4)
Dim drr As DataRow = DataTables("会计科目").find("科目代码 = '"& str & "'")
If drr IsNot Nothing Then
e.Form.Controls("Label8").text = drr("科目名称") & " - 明细账"
End If
'
Dim cn As Connection = Connections("shxy")
Dim s As String = cn.ConnectionString
Dim idx As Integer = s.IndexOf("Data Source=")
Dim idx2 As Integer = s.IndexOf(";",idx)
vars("y") = s.SubString(idx+12,idx2 - idx-12)
vars("y") = vars("y").SubString(vars("y").Length - 8)
vars("y") = vars("y").SubString(0,4)
e.Form.Controls("neme").text = Tables("公司信息").rows(0)("公司名称")
e.Form.Controls("Label4").text = vars("y")
Dim dr4 As DataRow = DataTables("会计科目").find("科目代码 = '" & CurrentTable.Current("科目代码") & "'")
If dr4 IsNot Nothing Then
e.Form.Controls("tb科目代码").text = dr4("科目名称")
End If
DataTables("明细账查询").DataRows.Clear
Dim dr2 As DataRow = DataTables("会计科目").find("科目代码 = '" & CurrentTable.Current("科目代码") & "'")
If dr2 IsNot Nothing Then
If dr2.IsNull("期初余额") = False Then
Dim dr3 As DataRow = DataTables("明细账查询").addnew
dr3("日期") = New Date(vars("y"),01,01)
dr3("摘要") = "期初余额"
dr3("方向") = dr2("方向")
dr3("余额") = dr2("期初余额")
End If
End If
For Each dr As DataRow In DataTables("凭证明细").SQLSelect("科目代码 = '" & CurrentTable.Current("科目代码") & "'","","凭证ID")
Dim dr1 As DataRow = DataTables("明细账查询").AddNew()
dr1("日期") = dr("日期")
dr1("凭证ID") = dr("凭证ID")
dr1("摘要") = dr("摘要")
dr1("借方") = dr("借方金额")
dr1("贷方") = dr("贷方金额")
dr1("方向") = dr2("方向")
Next
Dim t As Table = Tables("明细账查询")
t.OpenView("明细账查询")
T.Grid.Styles.EmptyArea.backcolor = color.white '设置表格内空白区域的背景色为 白色
T.Grid.Styles.EmptyArea.Border.Style = 0 '去表格边框
Dim g As Subtotalgroup
t.SubtotalGroups.Clear()
t.GroupAboveData = False
t.TreeVisible = False
t.SpillNode = True
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "日期"
g.TotalOn = "借方,贷方"
g.upto = True
t.SubtotalGroups.Add(g)
t.Subtotal()
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "日期"
g.TotalOn = "借方,贷方"
g.Caption = "{0}年 累计"
g.DateGroup = DateGroupEnum.Year
g.upto = True
t.SubtotalGroups.Add(g)
t.Subtotal()