以文本方式查看主题
- Foxtable(狐表) (http://foxtable.net/bbs/index.asp)
-- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2)
---- 跨表引用逻辑问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=150324)
|
-- 作者:cd_tdh
-- 发布时间:2020/5/27 9:09:00
-- 跨表引用逻辑问题
请老师看看,跨表引用时,先输入 付款金额,在选择供货方名称,如果 付款金额>3000,判断是否签订合同,如没签订合同,清空供货方的相关信息,提示没签订合同,应该怎么改呢?
If e.DataRow("款项类别") <> "代理费" And e.DataRow("款项类别") <> "保险费" Then If e.DataRow("付款金额") > "30000" Then If e.DataCol.Name = "供货方名称" Then Dim nms()As String = {"供货方账号","供货方开户银行"} If e.NewValue Is Nothing Then For Each nm As String In nms e.DataRow(nm)= Nothing Next Else Dim cmd As New SQLCommand Dim dt As DataTable cmd.C cmd.CommandText = "S ELECT DISTINCT 供货方名称,供货方账号,供货方开户银行 From {采购合同管理} where [供货方名称]= \'" & e.NewValue & "\'" dt = cmd.ExecuteReader() If dt.datarows.count > 0 Dim dr As DataRow = dt.datarows(0) For Each nm As String In nms e.DataRow(nm)= dr(nm) Next e.DataRow("是否签订采购合同") = True Else e.DataRow("供货方名称") = Nothing e.DataRow("是否签订采购合同") = False MessageBox.Show("未签订合同,不能委托支付") Return End If End If End If End If End If
|
-- 作者:有点蓝
-- 发布时间:2020/5/27 9:20:00
--
没看出有什么问题。
|
-- 作者:cd_tdh
-- 发布时间:2020/5/27 9:22:00
--
小于30000,不强制签订,但是也需要引用数据过来,没引用过来啊。
|
-- 作者:有点蓝
-- 发布时间:2020/5/27 9:31:00
--
If e.DataRow("款项类别") <> "代理费" And e.DataRow("款项类别") <> "保险费" Then If e.DataCol.Name = "供货方名称" Then Dim nms()As String = {"供货方账号","供货方开户银行"} If e.NewValue Is Nothing Then For Each nm As String In nms e.DataRow(nm)= Nothing Next Else Dim cmd As New SQLCommand Dim dt As DataTable cmd.C cmd.CommandText = "S ELECT DISTINCT 供货方名称,供货方账号,供货方开户银行 From {采购合同管理} where [供货方名称]= \'" & e.NewValue & "\'" dt = cmd.ExecuteReader() If dt.datarows.count > 0 Dim dr As DataRow = dt.datarows(0) For Each nm As String In nms e.DataRow(nm)= dr(nm) Next e.DataRow("是否签订采购合同") = True Else e.DataRow("供货方名称") = Nothing e.DataRow("是否签订采购合同") = False MessageBox.Show("未签订合同,不能委托支付") Return End If If e.DataRow("付款金额") <= "30000" Then e.DataRow("供货方名称") = Nothing e.DataRow("是否签订采购合同") = False end if End If End If
End If
|
-- 作者:cd_tdh
-- 发布时间:2020/5/29 16:46:00
--
老师,你那个方法不对,我判断的有点复杂,代码如下,先选择了款项类别和付款金额,在选择供货方信息,是正确的,但是如果我先选择了供货方信息,在填金额,判断没起到作用,应该怎么写呢?
If e.DataRow("款项类别") <> "代理费" And e.DataRow("款项类别") <> "保险费" Then If e.DataRow("付款金额") > "30000" Then If e.DataCol.Name = "供货方名称" Then Dim nms()As String = {"供货方账号","供货方开户银行"} If e.NewValue Is Nothing Then For Each nm As String In nms e.DataRow(nm)= Nothing Next Else Dim cmd As New SQLCommand Dim dt As DataTable cmd.C cmd.CommandText = "S ELECT DISTINCT 供货方名称,供货方账号,供货方开户银行 From {采购合同管理} where [供货方名称]= \'" & e.NewValue & "\'" dt = cmd.ExecuteReader() If dt.datarows.count > 0 Then Dim dr As DataRow = dt.datarows(0) For Each nm As String In nms e.DataRow(nm)= dr(nm) Next e.DataRow("是否签订采购合同") = True Else e.DataRow("供货方名称") = Nothing e.DataRow("是否签订采购合同") = False MessageBox.Show("该供应商还未签订供应合同,不能办理委托支付事宜!","提示",MessageBoxButtons.OK,MessageBoxIcon.None) Return End If End If End If Else Dim nmw()As String = {"供货方账号","供货方开户银行"} Dim cmd As New SQLCommand Dim dt As DataTable cmd.C cmd.CommandText = "S ELECT DISTINCT 供货方名称,供货方账号,供货方开户银行 From {采购合同管理} where [供货方名称]= \'" & e.NewValue & "\'" dt = cmd.ExecuteReader() If dt.datarows.count > 0 Then Dim dr As DataRow = dt.datarows(0) For Each nm As String In nmw e.DataRow(nm)= dr(nm) Next e.DataRow("是否签订采购合同") = True End If End If End If
|
-- 作者:有点蓝
-- 发布时间:2020/5/29 17:12:00
--
If e.DataCol.Name = "供货方名称" Then 改为 If e.DataCol.Name = "供货方名称" orelse e.DataCol.Name = "付款金额" Then
|
-- 作者:cd_tdh
-- 发布时间:2020/6/8 17:29:00
--
老师,我选择了款项类别和输入>30000的金额,供货方名称还未空时,会提示未签订采购合同,需要增加一个判断,增加到哪儿呢?
还有就是<30000时,如果签订了合同,是否签订合同也=true
[此贴子已经被作者于2020/6/8 17:30:02编辑过]
|
-- 作者:有点蓝
-- 发布时间:2020/6/8 17:36:00
--
需要在哪一步进行判断就增加到哪里
If e.DataRow("付款金额") > "30000" Then 相关处理逻辑 else <30000时的处理逻辑 endif
|
-- 作者:cd_tdh
-- 发布时间:2020/6/8 17:41:00
--
老师,后面问题解决了的,前面问题应该哪儿判断呢?
我选择了款项类别和输入>30000的金额,供货方名称为空时,会提示未签订采购合同,需要增加一个判断,增加到哪儿呢?
If e.DataRow("款项类别") <> "代理费" And e.DataRow("款项类别") <> "保险费" Then If e.DataRow("付款金额") >= "30000" Then If e.DataCol.Name = "供货方名称" OrElse e.DataCol.Name = "付款金额" Then Dim nms()As String = {"供货方账号","供货方开户银行"} If e.NewValue Is Nothing Then For Each nm As String In nms e.DataRow(nm)= Nothing Next Else Dim cmd As New SQLCommand Dim dt As DataTable cmd.C cmd.CommandText = "S ELECT DISTINCT 供货方名称,供货方账号,供货方开户银行 From {采购合同管理} where [供货方名称]= \'" & e.NewValue & "\'" dt = cmd.ExecuteReader() If dt.datarows.count > 0 Then Dim dr As DataRow = dt.datarows(0) For Each nm As String In nms e.DataRow(nm)= dr(nm) Next e.DataRow("是否签订采购合同") = True Else e.DataRow("供货方名称") = Nothing e.DataRow("是否签订采购合同") = False MessageBox.Show("该供应商还未签订供应合同,不能办理委托支付事宜!","提示",MessageBoxButtons.OK,MessageBoxIcon.None) Return End If End If End If Else Dim nmw()As String = {"供货方账号","供货方开户银行"} Dim cmd As New SQLCommand Dim dt As DataTable cmd.C cmd.CommandText = "S ELECT DISTINCT 供货方名称,供货方账号,供货方开户银行 From {采购合同管理} where [供货方名称]= \'" & e.NewValue & "\'" dt = cmd.ExecuteReader() If dt.datarows.count > 0 Then Dim dr As DataRow = dt.datarows(0) For Each nm As String In nmw e.DataRow(nm)= dr(nm) Next e.DataRow("是否签订采购合同") = True End If End If End If
[此贴子已经被作者于2020/6/8 17:41:37编辑过]
|
-- 作者:有点蓝
-- 发布时间:2020/6/8 20:08:00
--
If e.DataRow("款项类别") <> "代理费" And e.DataRow("款项类别") <> "保险费" Then If e.DataRow("付款金额") >= "30000" Then If e.DataCol.Name = "供货方名称" OrElse e.DataCol.Name = "付款金额" Then Dim nms()As String = {"供货方账号","供货方开户银行"} If e.DataRow.isnull("供货方名称") Then For Each nm As String In nms e.DataRow(nm)= Nothing Next Else Dim cmd As New SQLCommand Dim dt As DataTable cmd.C cmd.CommandText = "S ELECT DISTINCT 供货方名称,供货方账号,供货方开户银行 From {采购合同管理} where [供货方名称]= \'" & e.DataRow("供货方名称") & "\'" dt = cmd.ExecuteReader() If dt.datarows.count > 0 Then Dim dr As DataRow = dt.datarows(0) For Each nm As String In nms e.DataRow(nm)= dr(nm) Next e.DataRow("是否签订采购合同") = True Else e.DataRow("供货方名称") = Nothing e.DataRow("是否签订采购合同") = False MessageBox.Show("该供应商还未签订供应合同,不能办理委托支付事宜!","提示",MessageBoxButtons.OK,MessageBoxIcon.None) Return End If End If End If Else Dim nmw()As String = {"供货方账号","供货方开户银行"} Dim cmd As New SQLCommand Dim dt As DataTable cmd.C cmd.CommandText = "S ELECT DISTINCT 供货方名称,供货方账号,供货方开户银行 From {采购合同管理} where [供货方名称]= \'" & e.DataRow("供货方名称") & "\'" dt = cmd.ExecuteReader() If dt.datarows.count > 0 Then Dim dr As DataRow = dt.datarows(0) For Each nm As String In nmw e.DataRow(nm)= dr(nm) Next e.DataRow("是否签订采购合同") = True End If End If End If
|