-- 作者:有点甜
-- 发布时间:2018/4/4 10:07:00
--
\'\'\' Dim dr As DataRow = e.DataRow \'表中每一行进行多列合并,在文本框中作为一行 Select Case e.DataCol.Name Case "诉讼地位","诉讼参加人","性别","出生日期","民族","住所地","法定代表人","职务","单位","职业" Dim str = dr("诉讼地位") If str.contains("原告") Then If str.contains("委托代理人") Then \'下面是原告代理人各列合并 dr("原告出庭") = IIF(dr.IsNull("诉讼地位"),"",dr("诉讼地位").Replace("原告委托代理人","委托代理人")+"") dr("原告出庭") += IIF(dr.IsNull("诉讼参加人"),"",dr("诉讼参加人")+",") dr("原告出庭") += IIF(dr.IsNull("单位"),"",dr("单位") + "" ) dr("原告出庭") += IIF(dr.IsNull("职业"),"",dr("职业")+"。"+ vbcrlf) dr("原告出庭") = dr("原告出庭").trimend("。").trim(chr(10), chr(13)) Else \'下面是原告各列合并 dr("原告出庭") = IIF(dr.IsNull("诉讼地位"),"",dr("诉讼地位") +"") dr("原告出庭") += IIF(dr.IsNull("诉讼参加人"),"",dr("诉讼参加人")+",") dr("原告出庭") += IIF(dr.IsNull("性别"),"",dr("性别")+",") dr("原告出庭") += IIF(dr.IsNull("出生日期"),"",Format(dr("出生日期"), "yyyy年M月d日")+"出生,") dr("原告出庭") += IIF(dr.IsNull("民族"),"",dr("民族")+",") dr("原告出庭") += IIF(dr.IsNull("单位"),"",dr("单位")+"。" ) dr("原告出庭") += IIF(dr.IsNull("住所地"),"",dr("住所地") + "。" + vbcrlf) dr("原告出庭") += IIF(dr.IsNull("法定代表人"),"",dr("法定代表人")+",") \'法定代表人另起一行 dr("原告出庭") += IIF(dr.IsNull("职务"),"",dr("职务")+"。" + vbcrlf) dr("原告出庭") = dr("原告出庭").trimend("。").trim(chr(10), chr(13)) End If ElseIf str.contains("被告") Then If str.contains("委托代理人") Then \'下面是被告代理人各列合并 dr("被告出庭") = IIF(dr.IsNull("诉讼地位"),"",dr("诉讼地位").Replace("被告委托代理人","委托代理人")+"") dr("被告出庭") += IIF(dr.IsNull("诉讼参加人"),"",dr("诉讼参加人")+",") dr("被告出庭") += IIF(dr.IsNull("单位"),"",dr("单位") + "" ) dr("被告出庭") += IIF(dr.IsNull("职业"),"",dr("职业") + "。" + vbcrlf) dr("被告出庭") = dr("被告出庭").trimend("。").trim(chr(10), chr(13)) Else \'下面是被告各列合并 dr("被告出庭") = IIF(dr.IsNull("诉讼地位"),"",dr("诉讼地位")+"") dr("被告出庭") += IIF(dr.IsNull("诉讼参加人"),"",dr("诉讼参加人")+",") dr("被告出庭") += IIF(dr.IsNull("住所地"),"",dr("住所地")+"。" + vbcrlf) dr("被告出庭") += IIF(dr.IsNull("法定代表人"),"",dr("法定代表人")+",") \'法定代表人另起一行 dr("被告出庭") += IIF(dr.IsNull("职务"),"",dr("职务") + "。" + vbcrlf) dr("被告出庭") = dr("被告出庭").trimend("。").trim(chr(10), chr(13)) End If ElseIf str.contains("第三人") Then If str.contains("委托代理人") Then \'下面是第三人代理人各列合并 dr("第三人出庭") = IIF(dr.IsNull("诉讼地位"),"",dr("诉讼地位").Replace("第三人委托代理人","委托代理人")+"") dr("第三人出庭") += IIF(dr.IsNull("诉讼参加人"),"",dr("诉讼参加人")+",") dr("第三人出庭") += IIF(dr.IsNull("单位"),"",dr("单位") + "" ) dr("第三人出庭") += IIF(dr.IsNull("职业"),"",dr("职业") + "。"+ vbcrlf) dr("第三人出庭") = dr("第三人出庭").trimend("。").trim(chr(10), chr(13)) Else \'下面是第三人各列合并 dr("第三人出庭") = IIF(dr.IsNull("诉讼地位"),"",dr("诉讼地位") +"") dr("第三人出庭") += IIF(dr.IsNull("诉讼参加人"),"",dr("诉讼参加人") +",") dr("第三人出庭") += IIF(dr.IsNull("性别"),"",dr("性别")+",") dr("第三人出庭") += IIF(dr.IsNull("出生日期"),"",Format(dr("出生日期"), "yyyy年M月d日")+"出生,") dr("第三人出庭") += IIF(dr.IsNull("民族"),"",dr("民族")+",") dr("第三人出庭") += IIF(dr.IsNull("单位"),"",dr("单位")+"。" ) dr("第三人出庭") += IIF(dr.IsNull("住所地"),"",dr("住所地")+"。" + vbcrlf) dr("第三人出庭") += IIF(dr.IsNull("法定代表人"),"",dr("法定代表人")+",") \'法定代表人另起一行 dr("第三人出庭") += IIF(dr.IsNull("职务"),"",dr("职务")+"。" + vbcrlf) dr("第三人出庭") = dr("第三人出庭").trimend("。").trim(chr(10), chr(13)) End If End If End Select
\'==========将本案号 同列的多行合并,写入数据表,并将最终合并结果---[诉讼参加人]的值 写入窗口文本框 Dim str1 As String = “” Dim str2 As String = “” Dim str3 As String = “” For Each r As Row In Tables("诉讼参加人").Rows str1 += iif(r("原告出庭")>"", vbcrlf, "") & r("原告出庭") str2 += iif(r("被告出庭")>"", vbcrlf, "") & r("被告出庭") str3 += iif(r("第三人出庭")>"", vbcrlf, "") & r("第三人出庭") Next
Dim dr1 = DataTables("数据表").Find("[案号] = \'" & e.DataRow("案号") & "\'") dr1("原告出庭") = str1 dr1("被告出庭") = str2 dr1("第三人出庭") = str3 dr1("诉讼参加人") = str1 & iif(str2>"", vbcrlf, "") & str2 & iif(str3>"", vbcrlf, "") & str3
If Forms("当事人").opened Then Forms("当事人").Controls("TextBox1").text = str1 & str2 &str3 Else Return End If
|