Dim wb As New WeUI '定义一个基于weui框架的网页生成器
Dim e As RequestEventArgs = args(0)
'Dim u As String = e.cookies("name")
Dim s As String = e.cookies("部门")
'Dim x As String = e.cookies("岗位")
'For Each dr As DataRow In DataTables("财务流水").sqlSelect("[部门] = '" & s & "'","日期 Desc")
With wb.AddTable("","Table1")
'.MergeCols = 2 '合并左边2列
.Alternate = 3
Dim nms() As String = {"经手人","编号","科目","摘要","收入","支出","日期" }
.Head.AddRow(nms)
For Each r As DataRow In DataTables("财务流水").sqlSelect("[部门] = '" & s & "'", "", "日期 Desc")
在表格的顶端生成数据汇总,汇总收入和支出 怎么编写代码呢
With .Body.AddRow(r("经手人"),r("编号"),r("科目"),r("摘要"))
.AddCell(Format(r("收入"),"#0.00"))
.AddCell(Format(r("支出"),"#0.00"))
.AddCell(Format(r("日期"),"MM月dd日"))
End With
Next
End With
e.WriteString(wb.Build)
搞不清了
Dim wb As New WeUI '定义一个基于weui框架的网页生成器
Dim e As RequestEventArgs = args(0)
'Dim u As String = e.cookies("name")
Dim s As String = e.cookies("部门")
'Dim x As String = e.cookies("岗位")
'For Each dr As DataRow In DataTables("财务流水").sqlSelect("[部门] = '" & s & "'","日期 Desc")
With wb.AddTable("","Table1")
'.MergeCols = 2 '合并左边2列
.Alternate = 3
Dim nms() As String = {"经手人","编号","科目","摘要","收入","支出","日期" }
.Head.AddRow(nms)
Dim qty As Integer
Dim amt As Double
For i As Integer = 0 To dt.DataRows.count - 1
Dim r As DataRow = dt.DataRows(i)
If i > 0 Then
Dim lr As DataRow = dt.DataRows(i-1)
If r("科目") <> lr("科目") Then
qty = dt.compute("sum(收入)","收入='" & lr("收入") & "' )
amt = dt.compute("sum(支出)","支出='" & lr("支出") & "')
With .Body.AddRow()
.Attribute = "style='background-color:#F0FFFF'"
.AddCell("小计 " & lr("科目"),"colspan='3'")
.AddCells(qty,"",amt,"")
End With
Next
For Each r As DataRow In DataTables("财务流水").sqlSelect("[部门] = '" & s & "'", "", "日期 Desc")
With .Body.AddRow(r("经手人"),r("编号"),r("科目"),r("摘要"))
.AddCell(Format(r("收入"),"#0.00"))
.AddCell(Format(r("支出"),"#0.00"))
.AddCell(Format(r("日期"),"MM月dd日"))
End With
Next
End With
e.WriteString(wb.Build)