以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  这个错误是怎么形成的?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=31792)

--  作者:YDS
--  发布时间:2013/4/20 16:52:00
--  这个错误是怎么形成的?


图片点击可在新窗口打开查看此主题相关图片如下: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

 

 

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:销售管理.rar


--  作者:Bin
--  发布时间:2013/4/20 16:59:00
--  
漏了个A 
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:销售管理.table


--  作者:菲舍尔
--  发布时间:2013/4/21 0:17:00
--  
Dim drj As DataRow = DataTables("进货").Find("日期 = #" & rq & "# and 分类 = \'" & fl & "\' And 名称 = \'" & mc & "\' And 单位 = \'" & dw & "\' And 单价 = \'" & dj & "\' And 供应商 = \'" & gys & "\'")