Select Case e.DataCol.name
Case "工程名称","工程编码","合计","短缺数","缺口日期","总短缺数"
Case Else
Dim hj1 As Integer = 0
Dim hj2 As Integer = 0
Dim b As Boolean = True
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 b Then
If hj1 > e.DataRow("当前库存") Then
e.DataRow("缺口日期")= dc.Name
e.DataRow("短缺数")=hj1 - e.DataRow("当前库存")
hj2 = e.DataRow("短缺数")
b = False
End If
Else
hj2 += e.DataRow(dc.Name)
End If
End If
Next
If hj2 > 0 Then
e.DataRow("总短缺数")=hj2
Else
e.DataRow("缺口日期")=Nothing
e.DataRow("短缺数")=0
e.DataRow("总短缺数")=0
End If
e.DataRow("合计")=hj1
End Select