max = e.DataTable.SqlCompute("Max(fa piao号)","fa piao号 Like '" & bh & "%'")
Dim max2 As String = DataTables("退费信息").SqlCompute("Max(fa piao号)","fa piao号 Like '" & bh & "%'")
If max > "" OrElse max2 > "" Then
Dim m As String = IIF(max > max2,max,max2)
Dim v As Integer = m.SubString(6,4)
e.DataRow("fa piao号") = bh & format(v +1,"0000")
Else
e.DataRow("fa piao号") = bh & "0001"
End If