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


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

主题:移动版汇总金额

帅哥哟,离线,有人找我吗?
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)

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:111413 积分:567135 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2018/2/11 10:21:00 [只看该作者]

.Head.AddRow(nms)
.body.AddRow("汇总","","","",DataTables("财务流水").compute("sum(收入)","[部门] = '" & s & "'"),DataTables("财务流水").compute("sum(支出)","[部门] = '" & s & "'"))
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
[此贴子已经被作者于2018/2/11 10:22:33编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
yifan3429
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | 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编辑过]

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/2/23 9:01:00 [只看该作者]

改成

 

dim sum1 as double = val(DataTables("财务流水").compute("sum(收入)","[部门] = '" & s & "'"))
dim sum2 as double = val(DataTables("财务流水").compute("sum(支出)","[部门] = '" & s & "'"))
.body.AddRow("汇总","","","",sum1,sum2)

 


 回到顶部