Foxtable(狐表)用户栏目专家坐堂 → 移动版汇总金额


  共有2507人关注过本帖树形打印复制链接

主题:移动版汇总金额

帅哥哟,离线,有人找我吗?
yifan3429
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:九尾狐 帖子:2482 积分:22932 威望:0 精华:0 注册:2011/3/29 17:14:00
移动版汇总金额  发帖心情 Post By:2018/2/11 1:32:00 [显示全部帖子]

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)

 回到顶部
帅哥哟,离线,有人找我吗?
yifan3429
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:九尾狐 帖子:2482 积分:22932 威望:0 精华:0 注册:2011/3/29 17:14:00
  发帖心情 Post By:2018/2/23 3:34:00 [显示全部帖子]

.NET Framework 版本:2.0.50727.8762
Foxtable 版本:2017.12.31.1
错误所在事件:自定义函数财务流水
详细错误信息:
调用的目标发生了异常。
未将对象引用设置到对象的实例。
Dim wb As New WeUI '定义一个基于weui框架的网页生成器
Dim e As RequestEventArgs = args(0)
Dim u As String = e.cookies("name")
With wb.AddTable("","Table1")
    .Alternate = 3
    Dim nms() As String = {"自编号","科目名称","摘要","收入","支出","日期" }
    .Head.AddRow(nms)
    .body.AddRow("汇总","","","",DataTables("财务流水").compute("sum(收入)","[经手人] = '" & u & "'"),DataTables("财务流水").compute("sum(支出)","[经手人] = '" & u & "'"))
     .body.AddRow("汇总","","","",DataTables("财务流水").compute("sum(收入)","[部门] = '" & s & "'"),DataTables("财务流水").compute("sum(支出)","[部门] = '" & s & "'"))
    For Each r As DataRow In DataTables("财务流水").sqlSelect("[经手人] = '" & u & "'", "", "日期 Desc")
        With .Body.AddRow(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)
[此贴子已经被作者于2018/2/23 3:35:40编辑过]

 回到顶部