If e.PostValues.Count > 0 Then
Functions.Execute("ZCSave",e) '保存表单数据
End If
Dim pr As DataRow '订单
Dim Page As Integer '页码变量
If e.GetValues.ContainsKey("page") Then '如果地址中有page参数
Integer.TryParse(e.GetValues("page"), page) '提取page参数
End If
Dim ds As New List(Of String)
ds = DataTables("学生基本信息").SQLGetValues("学期","","学期")
Dim d As String = ds (ds.Count - 1)
If e.GetValues.ContainsKey("oid") = False Then '如果没有传递订单编号,则新增与一个订单
pr = DataTables("财务支出").AddNew()
pr("学期") = d
pr("序号") = Functions.Execute("GetZCOrderID")
Else
pr = DataTables("财务支出").SQLFind("[_Identify]='" & e.GetValues("oid") & "'")
If pr Is Nothing Then '多用户情况下,必须考虑其他用户删除订单的可能.
wb.InSertHtml("此支出记录已被其他用户删除!")
e.WriteString(wb.Build)
Return "" '必须返回
End If
End If
Dim url As String = "zcedit.htm?page=" & page & "&oid=" & pr("_Identify") '传递页码和订单编号
Dim zx as string = "|优蒙艺术培训中心|玄武培训中心|".replace("|" &pr("培训中心")&"|","|[" & pr("培训中心") & "]|")
Dim lb as string = "|房租|演出报名费|考级报名费|礼品费|服装费|化妆费|其他|".replace("|" &pr("支出费用类别")&"|","|[" & pr("支出费用类别") & "]|")
Dim fs as string = "|支付宝|微信|现金|网银|其他|".replace("|" &pr("支出方式")&"|","|[" & pr("支出方式") & "]|")
Dim ser As Integer = pr("序号")
Dim max As Integer = DataTables("财务支出").SQLCompute("max(序号)")
Dim min As Integer = DataTables("财务支出").SQLCompute("min(序号)")
Dim lr As DataRow
Dim nr As DataRow
With wb.AddTabBar("form1","tb1",1)
If ser > min Then
lr = DataTables("财务支出").SQLFind("序号 = '"& ser &"'- 1")
.AddButton("btn4", "上一个", "./images/上一个.png","zcedit.htm?oid=" & lr("_Identify"))
End If
If ser < max Then
nr = DataTables("财务支出").SQLFind("序号 = '"& ser &"'+ 1")
.AddButton("btn5", "下一个", "./images/下一个.png","zcedit.htm?oid=" & nr("_Identify"))
End If
If e.GetValues.ContainsKey("oid") = False Then '如过是新增订单
.AddButton("btn6", "取消", "./images/返回.jpg","zcdelete.htm?page=" & page & "&key=" & pr("_Identify"))
Else
.AddButton("btn6", "返回", "./images/返回.jpg","ZCList.htm?page=" & page)
End If
End With
wb.AddForm("","form1",url)
With wb.AddInputGroup("form1","ipg1",iif(e.GetValues.ContainsKey("oid"),"编辑信息","新增信息"))
.AddHiddenValue("Identify",pr("_Identify"))
.AddInput("学期","学期","text").Value = pr("学期")
.AddSelect("培训中心","培训中心",zx)
.AddInput("支出时间","支出时间","date").Value = pr("支出时间")
.AddSelect("支出费用类别","支出费用类别",lb)
.AddInput("支出金额","支出金额","number").Value = pr("支出金额")
.AddSelect("支出方式","支出方式",fs)
With wb.AddInputGroup("form1","ipg2","备注")
.AddTextArea("bz",5).Value = pr("备注")
End With
End With
With wb.AddButtonGroup("form1","btg1",False)
.Add("btn1", "保存", "submit")
.Add("btn2", "重置", "reset")
If e.GetValues.ContainsKey("oid") = False Then '如过是新增订单
.Add("btn3", "取消", "button","zcdelete.htm?page=" & page & "&key=" & pr("_Identify"))
Else
.Add("btn3", "返回", "button","ZCList.htm?page=" & page)
End if
End With
pr.Save() '必须保存,而且必须在最后保存,因为SQLAddNew增加的行,保存之后就会销毁,无法再调用
If e.PostValues.Count > 0 Then '如果是通过提交按钮访问,则给一个已经保存的提示给用户,时长500毫秒
wb.AddToast("","t1", "已经保存",0).Msec= 1000
End If