以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]加载 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=185467) |
-- 作者:江南小城 -- 发布时间:2023/2/24 12:31:00 -- [求助]加载 老师好,下面是内部函数,在加载时行数不准确。 Dim TvwCtl As WinForm.TreeView = Args(0) \'要更新的Treeview控件 Dim TblName As String = Args(1) \'数据来源表Dim Columns As String = Args(2) \'要构建Treeview的字段 If Tables(TblName).Rows.Count = 0 Then Return Nothing TvwCtl.Form.StopRedraw TvwCtl.BuildTree(Tables(TblName).DataTable,Columns) Dim ArrColName() As String = Columns.Split("|") For i As Integer = 0 To Ubound(ArrColName) If Tables(TblName).DataTable.DataCols(ArrColName(i)).IsDate Then For Each Nd As WinForm.TreeNode In TvwCtl.AllNodes Dim idx As Integer = nd.Text.IndexOf(" ") If idx >= 0 AndAlso Nd.Level = i Then Nd.Text = Nd.Text.SubString(0,Nd.Text.IndexOf(" ")) Next End If Next TvwCtl.Nodes.Insert("显示所有行",0) TvwCtl.Form.ResumeRedraw |
-- 作者:有点蓝 -- 发布时间:2023/2/24 13:29:00 -- 请上传实例测试 |
-- 作者:江南小城 -- 发布时间:2023/2/24 17:47:00 -- 老师好,我重新测试了一下下面代码有时候能把A表完全复制到B表有时候会有遗漏几行(总共3000多行) If e.DataCol.Name = "收/支" ElseIf e.DataRow("收/支") = "不计收支" ThenDim nma() As String = {"入账编号","交易时间","交易分类","交易对方","对方账号","商品说明","收/支","金额","收/付款方式","交易状态","交易订单","商家订单号","时间_年","时间_月","时间_季","时间_日","备注" } \'A表数据来源列 Dim nmb() As String = {"入账编号","交易时间","交易分类","交易对方","对方账号","商品说明","收/支","金额","收/付款方式","交易状态","交易订单","商家订单号","时间_年","时间_月","时间_季","时间_日","备注" } \'B表数据接收列 e.DataRow.save Dim dr3 As DataRow = DataTables("不计收支表").Find("入账编号 = \'" & e.DataRow("入账编号") & "\'") \'找到指定返回的行 If dr3 Is Nothing Then dr3 = DataTables("不计收支表").AddNew End If For i As Integer = 0 To nma.Length - 1 dr3(nmb(i)) = e.DataRow(nma(i)) Next dr3("来源") = "手机账号3105" |
-- 作者:有点蓝 -- 发布时间:2023/2/25 8:39:00 -- 不计收支表有重复的入账编号? |
-- 作者:江南小城 -- 发布时间:2023/2/25 19:04:00 -- 老师 好,下面是入账编码的生成代码。 Select e.DataCol.Name Case "交易时间","编号"If e.DataRow.IsNull("交易时间") OrElse e.DataRow.IsNull("编号") Then e.DataRow("入账编号") = Nothing Else Dim d As Date = e.DataRow("交易时间") Dim y As Integer = d.Year Dim m As Integer = d.Month Dim Days As Integer = Date.DaysInMonth(y,m) Dim fd As Date = New Date(y,m,1) \'获得该月的第一天 Dim ld As Date = New Date(y,m,Days) \'获得该月的最后一天 Dim bh As String = "ZF" & Format(d,"yyMM") & "" \'生成编号的前缀 If e.DataRow("入账编号").StartsWith(bh) = False \'如果单据编号前缀不符 Dim max As String Dim idx As Integer Dim flt As String flt = "交易时间 >= #" & fd & "# And 交易时间 <= #" & ld & "# And [_Identify] <> " & e.DataRow("_Identify") max = e.DataTable.Compute("Max(入账编号)",flt) \'取得该月的相同工程代码的最大单据编号 If max > "" Then \'如果存在最大单据编号 idx = CInt(max.Substring(bh.length,4)) + 1 \'获得最大单据编号的后四位顺序号,并加1 Else idx = 1 \'否则顺序号等于1 End If e.DataRow("入账编号") = bh & Format(idx,"0000") End If End If End Select |
-- 作者:有点蓝 -- 发布时间:2023/2/26 19:42:00 -- 自己多测试,找出出错的规律,什么样的情况下会有遗漏 |