以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]发现这代码 还是有些问题,功能没达成!  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=13118)

--  作者:gaoyong30000
--  发布时间:2011/9/28 14:37:00
--  [求助]发现这代码 还是有些问题,功能没达成!
原帖地址
http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=13105


修改后的这段代码

If user.group <> "客服部" Then
    DataTables("销售意向客户进度管制") .DeleteFor("[客户名称] Is Null and [联系地址] Is Null and [联系号码] Is Null And [欲购车型] Is Null and [意向级别] Is Null and [建档日期] Is Null and [最后联系日期] Is Null and [下次回访日期] Is Null and [最后一次回访情况] Is Null and [备注] Is Null and [客户来源] Is Null and [业务员申请] Is Null")
End If
For Each r As Row In Tables("销售意向客户进度管制")
    For Each cl As col In Tables("销售意向客户进度管制").Cols
        If "客户名称|意向级别|建档日期|最后联系日期|最后一次回访情况".IndexOf(cl.name) > -1
            If r.Isnull(cl.name) =True Then
                MessageBox.Show(cl.name & "未填写", "提示", MessageBoxButtons.ok, MessageBoxIcon.Information)
                Return
                Exit For
            End If
        End If
    Next
    If user.group = "销售部"
        If r("业务员申请")= "驳回 修改申请" Or r("业务员申请")= "驳回 删除申请" Or r("业务员申请")= "驳回 战败申请" Or r("业务员申请")= "驳回 战胜申请" Or r("业务员申请")= "驳回 修改申请" Or r("业务员申请")= "批准修改" Or r("业务员申请")= "批准删除" Or r("业务员申请")= "批准战胜" Or r("业务员申请")= "批准战败"  Then
            r("业务员申请")  =""
        End If
    End If
Next
If user.group <> "客服部" Then
    Dim f As New Filler
    f.SourceTable = DataTables("销售意向客户进度管制") \'指定数据来源
    f.SourceCols = "编号,意向级别,最后联系日期,最后一次回访情况,备注" \'指定数据来源列
    f.DataTable = DataTables("意向客户历史回访情况") \'指定数据接收表
    f.DataCols = "编号,意向级别,最后联系日期,最后一次回访情况,备注" \'指定数据接收列
    f.ExcludeExistValue =True
    f.ExcludeNullValue =False
    f.Distinct =True
    f.Append =True
    f.Fill()
    If user.name <> "销售经理" AndAlso user.name <> "开发者"
        For Each r As Row In Tables("销售意向客户进度管制")
            r("客户资料锁定") = True
        Next
    End If
End If
DataTables("销售意向客户进度管制").Save()

DataTables("意向客户历史回访情况").Save()




放在beforecloseproject 中   如果关闭项目的时候    客户名称|意向级别|建档日期|最后联系日期|最后一次回访情况  中有空值的话   只是提示一下  最后 还是能关闭项目的!

1.这段代码的其它功能(删除,同步历史记录表,锁定等要在 客户名称|意向级别|建档日期|最后联系日期|最后一次回访情况】 没有空值的情况下 才能执行)

2.请问如何使得 有空值的话 不可关闭项目 ?


[此贴子已经被作者于2011-9-28 14:40:45编辑过]

--  作者:程兴刚
--  发布时间:2011/9/28 14:40:00
--  

您指的是那一列有空值?须明示才行!


--  作者:狐狸爸爸
--  发布时间:2011/9/28 14:41:00
--  

http://www.foxtable.com/help/topics/0668.htm

 


--  作者:程兴刚
--  发布时间:2011/9/28 15:15:00
--  

1、增加逻辑型全局变量 Vars("有空值") ,原代码增加两行(红色部分)

 

If user.group <> "客服部" Then
    DataTables("销售意向客户进度管制") .DeleteFor("[客户名称] Is Null and [联系地址] Is Null and [联系号码] Is Null And [欲购车型] Is Null and [意向级别] Is Null and [建档日期] Is Null and [最后联系日期] Is Null and [下次回访日期] Is Null and [最后一次回访情况] Is Null and [备注] Is Null and [客户来源] Is Null and [业务员申请] Is Null")
End If
For Each r As Row In Tables("销售意向客户进度管制")
    For Each cl As col In Tables("销售意向客户进度管制").Cols
        If "客户名称|意向级别|建档日期|最后联系日期|最后一次回访情况".IndexOf(cl.name) > -1
            If r.Isnull(cl.name) =True Then
                Vars("有空值") = True
                MessageBox.Show(cl.name & "未填写", "提示", MessageBoxButtons.ok, MessageBoxIcon.Information)
                Return
                Exit For
            End If
        End If
    Next
    If user.group = "销售部"
        If r("业务员申请")= "驳回 修改申请" Or r("业务员申请")= "驳回 删除申请" Or r("业务员申请")= "驳回 战败申请" Or r("业务员申请")= "驳回 战胜申请" Or r("业务员申请")= "驳回 修改申请" Or r("业务员申请")= "批准修改" Or r("业务员申请")= "批准删除" Or r("业务员申请")= "批准战胜" Or r("业务员申请")= "批准战败"  Then
            r("业务员申请")  =""
        End If
    End If
Next
If user.group <> "客服部" Then
    Dim f As New Filler
    f.SourceTable = DataTables("销售意向客户进度管制") \'指定数据来源
    f.SourceCols = "编号,意向级别,最后联系日期,最后一次回访情况,备注" \'指定数据来源列
    f.DataTable = DataTables("意向客户历史回访情况") \'指定数据接收表
    f.DataCols = "编号,意向级别,最后联系日期,最后一次回访情况,备注" \'指定数据接收列
    f.ExcludeExistValue =True
    f.ExcludeNullValue =False
    f.Distinct =True
    f.Append =True
    f.Fill()
    If user.name <> "销售经理" AndAlso user.name <> "开发者"
        For Each r As Row In Tables("销售意向客户进度管制")
            r("客户资料锁定") = True
        Next
    End If
End If
If user.group <> "客服部" Then
    DataTables("销售意向客户进度管制").Save()
    DataTables("意向客户历史回访情况").Save()
End If
Vars("有空值") = False

 

2、项目属性\\BeforeCloseProject事件代码:

 

if Vars("有空值") = Tru

    e.Cancel = True

end if