以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 报表 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=194398) |
||||
-- 作者:g1j2h3 -- 发布时间:2024/12/5 16:51:00 -- 报表 请教老师,想得到下边的表,是否能实现
我写了如下代码,有错误 Dim sql As String = "Sele ct 接单日期,{接单登记}.接单单号,期望发货日期,客户来源,客户名称,收货地址,产品名称,规格型号,单位,单价,销售数量,发货数量 as 已发货数量,(销售数量 - 发货数量) AS 未发货数量 From ({接单登记} Inner JOIN {接单明细} ON {接单明细}.[接单单号] = {接单登记}.[接单单号]) ORDER BY 接单日期" Dim bd2 As New CrossTableBuilder("统计表2", sqlf) Dim nms As String() = {"接单单号", "客户名称", "产品名称" }
[此贴子已经被作者于2024/12/5 16:55:34编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2024/12/5 17:33:00 -- 请上传实例测试 |
||||
-- 作者:g1j2h3 -- 发布时间:2024/12/5 20:04:00 -- 实例
|
||||
-- 作者:有点蓝 -- 发布时间:2024/12/5 21:04:00 --
|
||||
-- 作者:g1j2h3 -- 发布时间:2024/12/5 21:37:00 -- 感谢老师的指点! |
||||
-- 作者:g1j2h3 -- 发布时间:2024/12/6 11:31:00 -- 再追问一下大师,导出报表时如何象一楼表中只显示有发货数量的列,没有发货的不显示 Dim filter As String With e.Form.Controls("cmbCustname") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "客户名称 = \'" & .Value & "\'" End If End With If Filter > "" Then Tables("窗口2_Table1").Filter = Filter End If Dim dt As Table = Tables("窗口2_Table1") Dim Book As New XLS.Book \'定义一个Excel工作簿 Dim Sheet As XLS.Sheet = Book.Sheets(0) \'引用工作簿的第一个工作表 For c As Integer = 0 To dt.Cols.Count - 1 \'添加列标题 Sheet(0, c).Value = dt.Cols(c).Name Next For r As Integer = 0 To dt.Rows.Count - 1 \'填入数据 For c As Integer = 0 To dt.Cols.Count - 1 Sheet(r + 1, c).Value = dt.rows(r)(c) Next Next \'打开工作簿 Book.Save("c:\\reports\\test.xls") Dim Proc As New Process Proc.File = "c:\\reports\\test.xls" Proc.Start() \'For Each c As Col In Tables("窗口2_Table1").cols \'If c.name Like "发货日期_*" Then \'If Tables("窗口2_Table1").comoute("count(" & c.name & ")", c.name & " is not null") > 0 Then \'If Tables("窗口2_Table1").compute("发货数量") = 0 Then \'Tables("窗口2_Table1").cols("发货日期").visible = True \'End If [此贴子已经被作者于2024/12/7 14:29:20编辑过]
|