Foxtable(狐表)用户栏目专家坐堂 → 自动编号


  共有3729人关注过本帖平板打印复制链接

主题:自动编号

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/6/27 11:53:00 [只看该作者]

Select e.DataCol.Name
    Case "制单日期"
        If e.DataRow.IsNull("制单日期") Then
            e.DataRow("送检单编号") = Nothing
        Else
            Dim d As Date = e.DataRow("制单日期")
            Dim y As Integer = d.Year
            Dim bh As String = Format(d,"yyyy")
            d = new Date(y, 1, 1)
            If e.DataRow("送检单编号").StartsWith(bh) = False
                Dim max As String
                Dim idx As Integer
                max = e.DataTable.Compute("Max(送检单编号)","制单日期 >= #" & d & "# And 制单日期 < #" & d.addyears(1) & "# and [_Identify] <> " & e.DataRow("_Identify"))
                If max > "" Then
                    idx = CInt(max.Substring(7)) + 1
                Else
                    idx = 1
                End If
                e.DataRow("内部合同编号") = bh & "-F-" & Format(idx,"000")
                e.DataRow.Save
            End If
        End If
End Select

[此贴子已经被作者于2018/6/27 11:54:16编辑过]

 回到顶部