此主题相关图片如下:01.jpg
确定按钮代码
DataTables("产品").load()
DataTables("库存").load()
DataTables("供应商").load()
Dim rq As Date = e.Form.Controls("rq").Value
Dim gys As String = e.Form.Controls("gys").Value
Dim fl As String = e.Form.Controls("fl").Value
Dim mc As String = e.Form.Controls("mc").Value
Dim dw As String = e.Form.Controls("dw").Value
Dim sl As Double = e.Form.Controls("sl").Value
Dim dj As Double = e.Form.Controls("dj").Value
Dim dr As DataRow = DataTables("库存").Find("分类 = '" & fl & "'And 名称 = '" & mc & "' And 单位 = '" & dw & "'")
Dim drj As DataRow = DataTables("进货").Find("日期 = #" & rq & "# and 分类 = '" & fl & "' nd 名称 = '" & mc & "' And 单位 = '" & dw & "' And 单价 = '" & dj & "' And 供应商 = '" & gys & "'")
If dr IsNot Nothing Then
If drj IsNot Nothing Then
If drj("数量") + e.Form.Controls("sl").Value >= 0 AndAlso dr("数量") + e.Form.Controls("sl").Value >= 0 Then
dr("数量") = dr("数量") + e.Form.Controls("sl").Value
drj("数量") = drj("数量") + e.Form.Controls("sl").Value
Else
MessageBox.Show("数量填写错误,请核查!","温馨提示")
e.Form.Controls("sl").Value = Nothing
End If
Else
If e.Form.Controls("sl").Value > 0 Then
dr("数量") = dr("数量") + e.Form.Controls("sl").Value
If dr("单价") < dj Then
dr("单价") = dj
End If
Dim dn As DataRow = DataTables("进货").AddNew()
dn("日期") = rq
dn("分类") = fl
dn("名称") = mc
dn("单位") = dw
dn("数量") = sl
dn("单价") = dj
dn("供应商") = gys
Else
MessageBox.Show("数量填写错误,请核查!","温馨提示")
e.Form.Controls("sl").Value = Nothing
End If
End If
ElseIf dr Is Nothing Then
If e.Form.Controls("sl").Value > 0 Then
Dim djn As DataRow = DataTables("进货").AddNew()
djn("日期") = rq
djn("分类") = fl
djn("名称") = mc
djn("单位") = dw
djn("数量") = sl
djn("单价") = dj
djn("供应商") = gys
Dim drn As DataRow = DataTables("库存").AddNew()
drn("分类") = fl
drn("名称") = mc
drn("单位") = dw
drn("数量") = sl
drn("单价") = dj
Else
MessageBox.Show("数量填写错误,请核查!","温馨提示")
e.Form.Controls("sl").Value = Nothing
End If
End If
e.Form.Controls("sl").Value = Nothing
DataTables("进货").DeleteFor("[数量] = 0")
DataTables("进货").Save()
DataTables("库存").Save()
Tables("进货").Sort = "日期 DESC,分类"
Dim dt As DataTable = DataTables("进货")
Dim sum As Integer = dt.Compute("Sum(总价)","日期 = #" & rq & "# and 供应商 = '" & gys & "'")
e.Form.controls("jz").text = sum