If User.Group = "经理" Then
Dim jzr1 As String = Tables("客户").Current("客户名称")
Dim cnt1 As Integer = DataTables("日常业务").SQLCompute("Count(业务编号)","客户名称 = '" & jzr1 & "' And 已办结 = 0")
If cnt1 >= 1 Then '如果未办结业务
MessageBox.Show("此客户有未办结业务?先进行业务办结,再停用客户!", "提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
With Tables("客户")
If .Current IsNot Nothing Then
.Current.Reject()
End If
End With
Forms("客户增加窗口").Close()
Dim Filter1 As String = "客户名称 = '" & jzr1 & "' And 已办结 = 0"
DataTables("日常业务").LoadFilter = Filter1
DataTables("日常业务").Load()
MainTable = Tables("日常业务")'在此加入相应的代码
Forms("业务办理主窗口").Open()
Else
Dim jg1 As DialogResult
jg1 = MessageBox.Show("确定要停用此客户吗?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
If jg1 = DialogResult.Yes Then
Tables("客户").Current("停用人") = User.Name
Tables("客户").Current("停用时间") = Date.Today()
Tables("客户").Current("停用") = True
Tables("客户").Current("VIP") = False
Dim jg3 As DialogResult
jg3 = MessageBox.Show("现在将终止此客户全部合同,确定要继续吗?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
If jg3 = DialogResult.Yes Then
Dim jzr2 As String = Tables("客户").Current("客户名称")
DataTables("合同附件之代理明细").SQLReplaceFor("已终止",1,"合同编号 in (select 合同编号 from 主合同 where 客户名称 = '" & jzr2 & "' and 已终止=0)")
DataTables("主合同").SQLReplaceFor("已终止",1,"客户名称 = '" & jzr2 & "' and 已终止=0")
MessageBox.Show("客户停用成功!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
With Tables("客户")
If .Current IsNot Nothing Then
.Current.Reject()
End If
End With
End If
Else
Tables("客户").Current("停用") = False
Tables("客户").Current("停用人") = Nothing
Tables("客户").Current("停用时间") = Nothing
End If
End If
Else
MessageBox.show("你无停用客户权限!")
End If
[此贴子已经被作者于2017/11/6 20:49:53编辑过]