stasal.vb

来自「超市进销存管理系统的源码。基于.NET平台」· VB 代码 · 共 34 行

VB
34
字号

Imports System.Data.SqlClient
Public Class StaSal
    Dim dbObj As New SCMDB.SCMDB
    Dim strCmd As String
    Public Function Refresh() As DataTable
        Return dbObj.CreateDataTableByKey("Sallistid as 销售单编号,prdid as 商品编号,Saldat as 销售日期,Salemp as 经手人, Salqua as 销售数量,Salprc as 销售价格,Salmemo as 销售说明", "Saleproduct")
    End Function
    Public Function Fnd(ByVal Dat1 As DateTime, ByVal Dat2 As DateTime, ByVal Nam As String, ByVal Emp As String) As DataTable
        '依次判断各条件是否生效
        strCmd = " 1 = 1 "
        If Dat1.Ticks < Dat2.Ticks Then
            strCmd &= " and saldat between  '" & Dat1 & "' and   '" & Dat2 & "' "
        End If
        If Nam <> "" Then
            strCmd &= " and prdid=" & Val(PrdNamToPrdId(SCMApp.STrim(Nam)))
        End If
        If Emp <> "" Then
            strCmd &= " and salemp='" & SCMApp.STrim(Emp) & "'"
        End If

        Return dbObj.CreateDataTableByKey("Sallistid as 销售单编号,prdid as 商品编号,Saldat as 销售日期,Salemp as 经手人, Salqua as 销售数量,Salprc as 销售价格,Salmemo as 销售说明", "saleproduct", strCmd)
    End Function
    Public Sub Print()
        Dim prtObj As New Print
        prtObj.Print("SaleProduct", strCmd)
    End Sub
    Private Function PrdNamToPrdId(ByVal PrdName As String) As String
        Dim dt As DataTable = New DataTable
        dt = dbObj.CreateDataTableBySQL("select prdid from productlist where prdname='" & PrdName & "'")
        Return dt.Rows(0).Item(0)
    End Function
End Class

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?