专柜费用表DataColChanged事件
Select Case e.DataCol.Name
Case "商户名称","抄表日期"
If e.DataRow.IsNull("商户名称") = False AndAlso e.DataRow.IsNull("抄表日期") = False
Dim d2 As Date = e.DataRow("抄表日期")
Dim d As Date = d2.AddMonths(-1)
Dim fd As Date = new Date(d.Year,d.Month,1)
Dim ld As Date = new Date(d2.Year,d2.Month,1)
Dim dr As DataRow = DataTables("费用总表").Find("商户名称='" & e.DataRow("商户名称") & "' And 抄表日期 >= #" & fd & "# And 抄表日期 < #" & ld & "#")
If dr IsNot Nothing Then
e.DataRow("水费_水表起码") = dr("水表止码")
e.DataRow("电费_电表起码") = dr("电表止码")
End If
End If
End Select