以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]在表属性能用,在项目属性里不管用 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=87582) |
-- 作者:zhangtongrt -- 发布时间:2016/7/14 8:50:00 -- [求助]在表属性能用,在项目属性里不管用 怎么能在项目属性里用 Select e.DataCol.Name If e.DataRow("人员编号").StartsWith(bh) = False If max > "" Then \'如果存在最大单据编号 |
-- 作者:Hyphen -- 发布时间:2016/7/14 8:55:00 -- http://www.foxtable.com/webhelp/scr/0671.htm 看中间的重要提示
|
-- 作者:大红袍 -- 发布时间:2016/7/14 9:15:00 -- 你没有开启对应的全局表事件?看2楼。 |
-- 作者:zhangtongrt -- 发布时间:2016/7/14 9:18:00 -- 已经能用了。不过出现错误了 .NET Framework 版本:2.0.50727.5485 |
-- 作者:zhangtongrt -- 发布时间:2016/7/14 9:19:00 -- 以下是引用大红袍在2016/7/14 9:15:00的发言:
你没有开启对应的全局表事件?看2楼。 .NET Framework 版本:2.0.50727.5485 |
-- 作者:大红袍 -- 发布时间:2016/7/14 9:22:00 -- If e.DataTable.Name = "AAA" Then 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 = e.DataRow("人员姓名") & "-" & Format(d,"yyMMdd") & "-" If e.DataRow("人员编号").StartsWith(bh) = False Dim max As String Dim idx As Integer Dim flt As String flt = "人员姓名 = \'"& e.DataRow("人员姓名") & "\' And 第一次收益时间 >= #" & fd & "# And 第一次收益时间 <= #" & ld & "# And [_Identify] <> " & e.DataRow("_Identify") max = e.DataTable.Compute("Max(人员编号)",flt) If max > "" Then \'如果存在最大单据编号 idx = CInt(max.Substring(bh.length)) + 1 Else idx = 1 End If e.DataRow("人员编号") = bh & Format(idx,"0000") End If End If End Select end if |
-- 作者:zhangtongrt -- 发布时间:2016/7/14 9:27:00 -- 以下是引用大红袍在2016/7/14 9:22:00的发言:
If e.DataTable.Name = "AAA" Then 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 = e.DataRow("人员姓名") & "-" & Format(d,"yyMMdd") & "-" If e.DataRow("人员编号").StartsWith(bh) = False Dim max As String Dim idx As Integer Dim flt As String flt = "人员姓名 = \'"& e.DataRow("人员姓名") & "\' And 第一次收益时间 >= #" & fd & "# And 第一次收益时间 <= #" & ld & "# And [_Identify] <> " & e.DataRow("_Identify") max = e.DataTable.Compute("Max(人员编号)",flt) If max > "" Then \'如果存在最大单据编号 idx = CInt(max.Substring(bh.length)) + 1 Else idx = 1 End If e.DataRow("人员编号") = bh & Format(idx,"0000") End If End If End Select end if 加个表名?那这是什么意思?
|
-- 作者:大红袍 -- 发布时间:2016/7/14 9:28:00 -- 1、全局表事件,肯定要先判断表名;
2、关键是这句代码 idx = CInt(max.Substring(bh.length)) + 1 |
-- 作者:zhangtongrt -- 发布时间:2016/7/14 9:31:00 -- 以下是引用大红袍在2016/7/14 9:28:00的发言:
1、全局表事件,肯定要先判断表名;
2、关键是这句代码 idx = CInt(max.Substring(bh.length)) + 1 能不能增加个日期判断呢?就比如表里有3个张三,日期分别是160601有两个和160605有一个,第一个编号应该是张三-160601-001,第二个张三-160601-002,第三个编号是张三160605-001?这样能实现么? |
-- 作者:大红袍 -- 发布时间:2016/7/14 9:37:00 -- If e.DataTable.Name = "AAA" Then 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 fd As Date = d Dim ld As Date = fd.AddDays(1) Dim bh As String = e.DataRow("人员姓名") & "-" & Format(d,"yyMMdd") & "-" If e.DataRow("人员编号").StartsWith(bh) = False Dim max As String Dim idx As Integer Dim flt As String flt = "人员姓名 = \'"& e.DataRow("人员姓名") & "\' And 第一次收益时间 >= #" & fd & "# And 第一次收益时间 < #" & ld & "# And [_Identify] <> " & e.DataRow("_Identify") max = e.DataTable.Compute("Max(人员编号)",flt) If max > "" Then \'如果存在最大单据编号 idx = CInt(max.Substring(bh.length)) + 1 Else idx = 1 End If e.DataRow("人员编号") = bh & Format(idx,"0000") End If End If End Select End If |