以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 统计表日期当天的最后一行 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=133813) |
-- 作者:yangwenghd -- 发布时间:2019/4/21 10:49: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) Dim sum As Double = DataTables("订单附表").Compute("Sum(订单核算_毛利)","业务往来_订单日期=#" & d1.AddDays(i) & "#") dr("收_油生意") = sum desc = DataTables("现金明细").Compute("desc(可控金额)","变动日期=#" & d1.AddDays(i) & "#") dr("现金流况") = desc Next
|
-- 作者:有点色 -- 发布时间:2019/4/21 17:56:00 -- 参考
Dim fdr = DataTables("现金明细").find("变动日期=#" & d1.AddDays(i) & "#", "_sortkey desc")
http://www.foxtable.com/webhelp/scr/0396.htm
|
-- 作者:yangwenghd -- 发布时间:2019/4/21 20:52: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) Dim sum As Double = DataTables("订单附表").Compute("Sum(订单核算_毛利)","业务往来_订单日期=#" & d1.AddDays(i) & "#") dr("收_油生意") = sum sum = DataTables("其它收入").Compute("Sum(收入金额)","收入时间=#" & d1.AddDays(i) & "#") dr("收_其它") = sum sum = DataTables("支出账目").Compute("Sum(合计价格)","支出日期=#" & d1.AddDays(i) & "#") dr("支_对公") = sum sum = DataTables("现金明细").Compute("Sum(可控金额)","变动日期=#" & d1.AddDays(i) & "#") dr("现金流况") = sum \'这列得到现金明细表的可控金额 对应的日期的最后有一行. Next [此贴子已经被作者于2019/4/21 20:52:41编辑过]
|
-- 作者:有点色 -- 发布时间:2019/4/22 11:39:00 --
上传具体实例测试。
|
-- 作者:yangwenghd -- 发布时间:2019/4/22 17:46:00 -- 感谢 感谢 点击统计,可以是吧现金流表的变动日期的最后一行复制到日统计的现金流况吗?
[此贴子已经被作者于2019/4/22 17:46:03编辑过]
|
-- 作者:有点甜 -- 发布时间:2019/4/22 17:47:00 --
Dim fdr = DataTables("现金明细").find("变动日期=#" & d1.AddDays(i) & "#", "_sortkey desc") dr("现金流况") = fdr("可控金额")
|
-- 作者:yangwenghd -- 发布时间:2019/4/22 21:06: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) Dim sum As Double = DataTables("订单附表").Compute("Sum(订单核算_毛利)","业务往来_订单日期=#" & d1.AddDays(i) & "#") dr("收_油生意") = sum sum = DataTables("其它收入").Compute("Sum(收入金额)","收入时间=#" & d1.AddDays(i) & "#") dr("收_其它") = sum sum = DataTables("支出账目").Compute("Sum(合计价格)","支出日期=#" & d1.AddDays(i) & "#") dr("支_对公") = sum sum = DataTables("支出明细").Compute("Sum(支出金额)","变动日期=#" & d1.AddDays(i) & "#") dr("支_对私") = sum Dim fdr = DataTables("现金明细").find("变动日期=#" & d1.AddDays(i) & "#", "_sortkey desc") dr("现金流况") = fdr("可控金额") Next |
-- 作者:有点蓝 -- 发布时间:2019/4/22 21:26:00 -- Dim fdr = DataTables("现金明细").find("变动日期=#" & d1.AddDays(i) & "#", "_sortkey desc") if fdr isnot nothing then dr("现金流况") = fdr("可控金额") end if
|
-- 作者:yangwenghd -- 发布时间:2019/4/22 22:37:00 -- 感谢 感谢 老师能再帮忙看看吗 实在是太麻烦你了 后面统计的 当没有内容的时候为0可以吗,和前面列的相同,感谢 感谢 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) Dim sum As Double = DataTables("订单附表").Compute("Sum(订单核算_毛利)","业务往来_订单日期=#" & d1.AddDays(i) & "#") dr("收_油生意") = sum sum = DataTables("其它收入").Compute("Sum(收入金额)","收入时间=#" & d1.AddDays(i) & "#") dr("收_其它") = sum sum = DataTables("支出账目").Compute("Sum(合计价格)","支出日期=#" & d1.AddDays(i) & "#") dr("支_对公") = sum sum = DataTables("支出明细").Compute("Sum(支出金额)","变动日期=#" & d1.AddDays(i) & "#") dr("支_对私") = sum Dim fdr = DataTables("现金明细").find("变动日期=#" & d1.AddDays(i) & "#", "_sortkey desc") If fdr IsNot Nothing Then dr("现金流况") = fdr("可控金额") End If Dim fda = DataTables("欠款明细").find("变动日期=#" & d1.AddDays(i) & "#", "_sortkey desc") If fda IsNot Nothing Then dr("负责_私况") = fda("欠款合计") End If Next |
-- 作者:有点蓝 -- 发布时间:2019/4/22 23:00:00 -- Dim fdr = DataTables("现金明细").find("变动日期=#" & d1.AddDays(i) & "#", "_sortkey desc") If fdr IsNot Nothing Then dr("现金流况") = fdr("可控金额") else dr("现金流况") = 0 End If
|