If e.DataCol.Name = "产品名称" Then
Dim dr As DataRow = e.DataRow
Dim dt As DataTable = DataTables("周转卡明细")
Dim frm As WinForm.Form = Forms("损耗率计算")
If frm.Opened Then
Dim d1 = frm.Controls("DateTimePicker1").value
Dim d2 = frm.Controls("DateTimePicker2").value
If d1 IsNot Nothing And d2 IsNot Nothing
dr("压铸") = dt.Compute("Sum(压铸良品数)","[产品名称] = '" & dr("产品名称") & "' and 日期 >= '" & d1 & "' and 日期 <= '" & d2 & "' ")
End If
Else
dr("压铸") = dt.Compute("Sum(压铸良品数)","[产品名称] = '" & dr("产品名称") & "'")
End If
End If