Dim shenling As WinForm.NumericComboBox = e.Form.Controls("NumericComboBox1")'申领数量
Dim yl As WinForm.Label = e.Form.Controls("lb_ylsl") '已领标签
Dim jhsl,ylsl,slsl,slheji As Double '计划数量,已领数量,申领数量,已领申领合计
slsl = Round2((shenling.Value),2)
'MessageBox.Show(slsl)
If slsl = 0 Then
MessageBox.Show("申领数量不能为零!")
e.Form.Controls("NumericComboBox1").Select()
Return
End If
jhsl = round2(Tables("计划审批").Current("k_quantity"),2)
ylsl = round2(Tables("计划审批").Current("Using_Number"),2)
slheji = Round2((ylsl + slsl),2)
If slheji > jhsl Then
MessageBox.Show("计划数量不足,请修改申领数量!")
Return
Else
Tables("计划审批").Current("Using_Number") = slheji
Tables("计划审批").Current.Save()
'调整显示数量
yl.Text = slheji
shenling.Value = Round2((jhsl - ylsl - slsl),2)
Dim rnew As DataRow
rnew = DataTables("填写料单").AddNew()
rnew("code") = Tables("计划审批").Current("code")
rnew("plan_time") = Tables("计划审批").Current("Plan_time")
'填写料单时间
Dim d As Date
Dim dy,dm As Integer
d = Functions.Execute("获取SQLServer服务器时间",_sjy)
dy = d.Year
dm = d.Month
rnew("fillin_time") = d
rnew("in_number") = slsl
rnew("price") = Tables("计划审批").Current("price")
rnew("in_person") = Vars("vtruename")
rnew("in_use") = ""
rnew("Sources_of_funding") = Tables("计划审批").Current("Sources_of_funding")
rnew("in_year") = dy
rnew("in_month") = dm
rnew("wgzx_number") = slsl
rnew("k_number") = slsl
rnew("Area_Quantity") = slsl
rnew("accounting_number") = slsl
rnew("Unit") = Tables("计划审批").Current("Unit")
rnew("Area") = Tables("计划审批").Current("area")
rnew("Department") = Tables("计划审批").Current("department")
rnew("name") = Tables("计划审批").Current("name")
rnew("check_number") = slsl
rnew("Primary_key") = Tables("计划审批").Current("Primary_key")
rnew("Specification") = Tables("计划审批").Current("Specification")
rnew("Model") = Tables("计划审批").Current("Model")
rnew("Department_Name") = Tables("计划审批").Current("Department_Name")
rnew("Supplier") = Tables("计划审批").Current("Provider")
rnew("plan_serial_number") = Tables("计划审批").Current("serial_number")
rnew("print_number") = 0
rnew("Area_Approval") = "未审核"
rnew("wgzx_approval") = "未审核"
rnew("k_approval") = "未审核"
rnew("accounting_operator") = "未记账"
'自动编号
rnew("Order_Number") = Functions.Execute("自动获取料单最大编号",dy,dm)
rnew.Save()
Tables("填写料单").Position = Tables("填写料单").Rows.Count - 1
End If
所有代码都在这里,这是窗口里面一个Button的Click代码,没有datacolchanged、beforeSaveDatarow事件。