Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]统计

1楼
风声 发表于:2023/10/26 19:02:00
老师,下面代码只统计到9月份
If e.DataCol.Name = "项目ID" OrElse e.DataCol.Name = "项目" Then
    For i As Integer = 1 To 12
        Dim Filter As String = e.DataRow("项目") & "_ID = '" & e.DataRow("项目ID") & "' and 月=" & i
        e.DataRow("M" & i) = DataTables("数据汇总").Compute("Sum(" & e.DataRow("项目") & "_应付)", Filter)
    Next
End If


If e.DataCol.Name Like "*房_ID" Then
    Dim pr As DataRow
    pr = DataTables("水电气统计").Find("项目 = '" & e.DataCol.Name.split("_")(0) & "' and 项目ID='" & e.newvalue & "'")
    If pr IsNot Nothing Then
        DataTables("水电气统计").DataCols("项目ID").RaiseDataColChanged(pr)
    End If
Else If e.DataCol.Name Like "*房_应付" Then
    Dim pr As DataRow
    pr = DataTables("水电气统计").Find("项目 = '" & e.DataCol.Name.split("_")(0) & "' and 项目ID='" & e.DataRow(e.DataCol.Name.split("_")(0) & "_ID") & "'")
    If pr IsNot Nothing Then
        DataTables("水电气统计").DataCols("项目ID").RaiseDataColChanged(pr)
    End If
End If
2楼
有点蓝 发表于:2023/10/26 20:07:00
应该是没有其它月份的数据,调试看看

If e.DataCol.Name = "项目ID" OrElse e.DataCol.Name = "项目" Then
    For i As Integer = 1 To 12
        Dim Filter As String = e.DataRow("项目") & "_ID = '" & e.DataRow("项目ID") & "' and 月=" & i
dim d as double = DataTables("数据汇总").Compute("Sum(" & e.DataRow("项目") & "_应付)", Filter)
msgbox("条件=" & Filter & “, 查询结果=” & d)
        e.DataRow("M" & i) = d
    Next
End If
3楼
江南小镇 发表于:2023/10/27 14:22:00
老师,下面的统计表超过10月份就不能统计了,另外保存时报错。

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:统计.zip

4楼
有点蓝 发表于:2023/10/27 15:21:00
月份改为整数列,不要使用字符列
共4 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .01953 s, 3 queries.