Foxtable(狐表)用户栏目专家坐堂 → 天统计


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

主题:天统计

帅哥,在线噢!
y2287958
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐神 帖子:4760 积分:34608 威望:0 精华:0 注册:2008/8/31 22:44:00
  发帖心情 Post By:2018/11/17 11:46:00 [显示全部帖子]

DataTables("表C").DataRows.Clear
Dim DateTimePicker1 As WinForm.DateTimePicker = Forms("窗口1").Controls("DateTimePicker1")
Dim d1 As Date = new Date(DateTimePicker1.Value.Year,DateTimePicker1.Value.Month,1)
Dim d2 As Date = d1.AddMonths(1).AddDays(-1)
For i As Integer = 0 To d2.Day - 1
    Dim dr As DataRow = DataTables("表C").AddNew
    dr("统计时间") = d1.AddDays(i)
    dr("统计金额表一") = DataTables("表A").Compute("Sum(金额)","时间=#" & d1.AddDays(i) & "#")
    dr("统计金额表二") = DataTables("表B").Compute("Sum(变动金额)","变动日期=#" & d1.AddDays(i) & "#")
Next


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


加好友 发短信
等级:狐神 帖子:4760 积分:34608 威望:0 精华:0 注册:2008/8/31 22:44:00
  发帖心情 Post By:2018/11/17 16:10:00 [显示全部帖子]

简单粗暴点
DataTables("日统计").DataRows.Clear
Dim DateTimePicker1 As WinForm.DateTimePicker = Forms("财务汇总窗口").Controls("DateTimePicker11")
Dim d1 As Date = new Date(DateTimePicker1.Value.Year,DateTimePicker1.Value.Month,1)
Dim d2 As Date = d1.AddMonths(1).AddDays(-1)
For i As Integer = 0 To d2.Day - 1
    Dim dr As DataRow = DataTables("日统计").AddNew
    dr("统计日期") = d1.AddDays(i)
    dr("收_其它") = DataTables("其它收入").Compute("Sum(收入金额)","收入时间=#" & d1.AddDays(i) & "#")
    dr("支_对公") = DataTables("支出账目").Compute("Sum(合计价格)","支出日期=#" & d1.AddDays(i) & "#")
    dr("支_对私") = DataTables("支出明细").Compute("Sum(支出金额)","变动日期=#" & d1.AddDays(i) & "#")
Next
DataTables("日统计").ReplaceFor("收_其它",0,"收_其它 is null")
DataTables("日统计").ReplaceFor("支_对公",0,"支_对公 is null")
DataTables("日统计").ReplaceFor("支_对私",0,"支_对私 is null")

 回到顶部