Select Case e.DataCol.name
Case "工程名称","工程编码","合计","短缺数","缺口日期","总短缺数"
Case Else
Dim hj1 As Integer = 0
Dim hj2 As Integer = 0
For Each dc As Col In Tables("工程表").Cols
If dc.Index>6 And e.DataRow.IsNull(dc.Name)=False Then
hj1 += e.DataRow(dc.Name)
If hj1 > e.DataRow("当前库存") Then
e.DataRow("缺口日期")= dc.Name
hj2 = hj1
End If
End If
Next
If hj2 > e.DataRow("当前库存") Then
e.DataRow("短缺数")=hj2 - e.DataRow("当前库存")
e.DataRow("总短缺数")=hj1-hj2+e.DataRow("短缺数")
Else
e.DataRow("缺口日期")=Nothing
e.DataRow("短缺数")=0
e.DataRow("总短缺数")=0
End If
e.DataRow("合计")=hj1
End Select