以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 老师,手工统计没数据怎么回事呢? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=191682) |
-- 作者:cd_tdh -- 发布时间:2024/4/30 17:01:00 -- 老师,手工统计没数据怎么回事呢? Dim txt As String = e.Sender.Value If txt = "" Then e.Form.Controls("Panel2").Visible = True Else e.Form.StopRedraw() e.Form.Controls("Panel2").Visible = False Dim dtb As New DataTableBuilder("统计") dtb.AddDef("供货方名称", GetType(String), 100) dtb.AddDef("采购合同金额", GetType(Double)) dtb.AddDef("已支付金额", GetType(Double)) dtb.AddDef("未支付金额", GetType(Double)) dtb.AddDef("已开票金额", GetType(Double)) dtb.AddDef("未开票金额", GetType(Double)) dtb.AddDef("是否异常", GetType(Boolean)) dtb.AddDef("异常原因", GetType(String), 50) dtb.Build() Dim dt1 As DataTable = DataTables("采购合同管理") Dim dt2 As DataTable = DataTables("委托支付管理") Dim dt3 As DataTable = DataTables("进项票录入") For Each nm As String In dt1.SQLGetValues("供货方名称", "[项目名称] = \'" & txt & "\'") Dim dr As DataRow = DataTables("统计").AddNew() dr("供货方名称") = nm dr("采购合同金额") = dt1.sqlCompute("Sum(采购合同金额)", "[供货方名称] = \'" & dr("供货方名称") & "\'") dr("已支付金额") = dt2.sqlCompute("Sum(付款金额)", "[供货方名称] = \'" & dr("供货方名称") & "\'") dr("未支付金额") = dr("采购合同金额") - dr("已支付金额") dr("已开票金额") = dt3.sqlCompute("Sum(税价合计金额)", "[供货方名称] = \'" & dr("供货方名称") & "\'") dr("未开票金额") = dr("已支付金额") - dr("已开票金额") If dr("未开票金额") < 0 Then dr("是否异常") = True dr("异常原因") = "开票金额大余委托支付金额" ElseIf dr("未开票金额") > 0 Then dr("是否异常") = True dr("异常原因") = "付款后未收到足额的进项票" End If Next \' MainTable = Tables("统计") With Tables("采购合同数据分析_Table1") .DataSource = dtb.BuildDataSource() .DataTable.DataCols.Add("序号", GetType(Integer)) \'新增序号列 .DataTable.DataCols.Add("备注", GetType(String)) \'新增序号列 .Cols("序号").Move(0) For Each r As Row In Tables("采购合同数据分析_Table1").Rows r("序号") = r.index + 1 Next .DefaultRowHeight = 25 \'所有行高 .Cols("序号").TextAlign = TextAlignEnum.Center \'居中 .Cols("序号").Width = 60 .Cols("供货方名称").Width = 300 .Cols("采购合同金额").Width = 120 .Cols("已支付金额").Width = 120 .Cols("未支付金额").Width = 120 .Cols("已开票金额").Width = 120 .Cols("未开票金额").Width = 120 .Cols("是否异常").Width = 70 .Cols("异常原因").Width = 300 .ExtendLastCol = True \'自动列宽 End With e.Form.ResumeRedraw() End If
|
-- 作者:有点蓝 -- 发布时间:2024/4/30 17:10:00 -- 1、Build()和BuildDataSource只能使用其中一个 2、必须在添加数据前调用Build()或者BuildDataSource …… dtb.AddDef("异常原因", GetType(String), 50) With Tables("采购合同数据分析_Table1") .DataSource = dtb.BuildDataSource() Dim dt1 As DataTable = DataTables("采购合同管理") Dim dt2 As DataTable = DataTables("委托支付管理") Dim dt3 As DataTable = DataTables("进项piao录入") For Each nm As String In dt1.SQLGetValues("供货方名称", "[项目名称] = \'" & txt & "\'") Dim dr As DataRow = DataTables("采购合同数据分析_Table1").AddNew() dr("供货方名称") = nm dr("采购合同金额") = dt1.sqlCompute("Sum(采购合同金额)", "[供货方名称] = \'" & dr("供货方名称") & "\'") dr("已支付金额") = dt2.sqlCompute("Sum(付款金额)", "[供货方名称] = \'" & dr("供货方名称") & "\'") dr("未支付金额") = dr("采购合同金额") - dr("已支付金额") dr("已开piao金额") = dt3.sqlCompute("Sum(税价合计金额)", "[供货方名称] = \'" & dr("供货方名称") & "\'") dr("未开piao金额") = dr("已支付金额") - dr("已开piao金额") If dr("未开piao金额") < 0 Then dr("是否异常") = True dr("异常原因") = "开piao金额大余委托支付金额" ElseIf dr("未开piao金额") > 0 Then dr("是否异常") = True dr("异常原因") = "付款后未收到足额的进项piao" End If Next \' MainTable = Tables("统计") .DataTable.DataCols.Add("序号", GetType(Integer)) \'新增序号列 .DataTable.DataCols.Add("备注", GetType(String)) \'新增序号列 ……
|
-- 作者:cd_tdh -- 发布时间:2024/4/30 17:17:00 -- 谢谢 [此贴子已经被作者于2024/4/30 17:20:52编辑过]
|