此主题相关图片如下:未命名1.bmp
表属性
DataColChanged事件代码:
Dim dr As DataRow = e.DataRow
Dim dt As DataTable = DataTables("日报表")
Dim str As String = "年月 = '" & dr("年月") & "' And 日期 = '" & dr("日期") & "' And 工序_班组 = '" & dr("班组") & "' And 姓名 = '" & dr("姓名") & "'"
if e.DataCol.Name = "年月" OrElse e.DataCol.Name = "日期" OrElse e.DataCol.Name = "班组" OrElse e.DataCol.Name = "姓名" Then
Dim r As DataRow = dt.Find(str)
if r IsNot Nothing Then
dr("考核_装夹工时") = (dt.Compute("Sum(考核_装夹工时)",str))
dr("考核_操作工时") = (dt.Compute("Sum(考核_操作工时)",str))
dr("考核_准结工时") = (dt.Compute("Sum(考核_准结工时)",str))
dr("考核_标准工时")=(dt.Compute("Sum(考核_标准工时)",str))
dr("工作用时")=(dt.Compute("Sum(工作时间_用时)",str))
dr("工废损失")=(dt.Compute("Sum(工废_损失)",str))
dr("准结补贴")=(dt.Compute("Sum(准结补贴)",str))
dr("工资")=(dt.Compute("Sum(成本_加工费元)",str))
dr("产值")=(dt.Compute("Sum(成本_工资元)",str))
End If
End If
窗口按钮Click事件代码:
Dim Values As String() = {"年月","日期","班组"}
For Each Va as string In Values
with e.form
if .Controls(va).value Is Nothing then
MessageBox.Show(va &" 资料不全,请录入!", "提示")
end if
end with
Next
dim f As New Filler
f.SourceTable = DataTables("日报表") '指定数据来源
f.SourceCols = "年月,日期,工序_班组,姓名" '指定数据来源列
f.DataTable = DataTables("班组考勤") '指定数据接收表
f.ExcludeExistValue = true
f.DataCols = "年月,日期,班组,姓名" '指定数据接收列
f.filter = "[年月] = '" & e.Form.Controls("年月").Value & "' and [日期] = '" & e.Form.Controls("日期").Value & "' and [工序_班组] = '" & e.Form.Controls("班组").Value & "'"
f.Fill() '填充=据
是不是两个代码冲突,但是我要实现条件填充,然后提取来源表合计数据怎么处理。谢谢