- 打卡等级:无名新人
- 打卡总天数:1
- 打卡月天数:0
- 打卡总奖励:3
- 最近打卡:2024-10-23 18:41:09
|
发表于 2023-5-25 17:24:40
|
显示全部楼层
'执行按钮前执行该方法,objVoucher为单据或列表对象
'VarentValue为在表中预置的cVariant的值。
'objLogin代表UFToolbar上取得的Login信息
'objForm代表该Toolbar所在的窗体信息
'objVoucher代表Toolbar所在窗体上的单据控件对象或者单据列表对象
'sKey代表该按钮的ButtonKey
'VarentValue代表数据库预置的Varent值
Public Function BeforeRunSysCommand(ByVal objLogin As Object, ByVal objForm As Object, ByVal objVoucher As Object, _
ByVal sKey As String, ByVal VarentValue As Object, ByRef Cancel As Boolean, ByVal other As String) As Boolean
Dim cCusCode As String
Dim cInvCode As String
Dim sql As String
Dim Dt_data As New DataTable
U8SQLHelper.U8DB.connectionString = objLogin.UfDbName
'保存前检查000001客户不予许销售01000001此类产品,如果检查有此类产品,单据不允许保存,并且提醒用户
If sKey = "save" Then
For i = 1 To objVoucher.Rows
If Not String.IsNullOrEmpty(objVoucher.bodyText(i, "cInvCode")) Then
cInvCode = objVoucher.bodyText(i, "cInvCode")
cCusCode = objVoucher.headerText("cCusCode")
If (cCusCode = "00000001" And cInvCode = "01000001") Then
MsgBox("此商品01000001,不能销售给该客户!")
Cancel = True
Exit Function
End If
End If
Next
End If
Cancel = False
End Function |
|