⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmstasal.vb

📁 超市进销存管理系统的源码。基于.NET平台
💻 VB
字号:
Imports SCMAPP.Print
Public Class frmStaSal
    Inherits System.Windows.Forms.Form

#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化

    End Sub

    '窗体重写 dispose 以清理组件列表。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意: 以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改此过程。
    '不要使用代码编辑器修改它。
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents btnFnd As System.Windows.Forms.Button
    Friend WithEvents btnPrt As System.Windows.Forms.Button
    Friend WithEvents btnExt As System.Windows.Forms.Button
    Friend WithEvents grbCon As System.Windows.Forms.GroupBox
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents dtpSalDatEnd As System.Windows.Forms.DateTimePicker
    Friend WithEvents dtpSalDatFrom As System.Windows.Forms.DateTimePicker
    Friend WithEvents cmbPrdNam As System.Windows.Forms.ComboBox
    Friend WithEvents dgdSalList As System.Windows.Forms.DataGrid
    Friend WithEvents txtSalEmp As System.Windows.Forms.TextBox
    Friend WithEvents chkPrd As System.Windows.Forms.CheckBox
    Friend WithEvents chkDate As System.Windows.Forms.CheckBox
    Friend WithEvents chkEmp As System.Windows.Forms.CheckBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.grbCon = New System.Windows.Forms.GroupBox
        Me.chkEmp = New System.Windows.Forms.CheckBox
        Me.chkPrd = New System.Windows.Forms.CheckBox
        Me.chkDate = New System.Windows.Forms.CheckBox
        Me.txtSalEmp = New System.Windows.Forms.TextBox
        Me.dtpSalDatEnd = New System.Windows.Forms.DateTimePicker
        Me.dtpSalDatFrom = New System.Windows.Forms.DateTimePicker
        Me.Label4 = New System.Windows.Forms.Label
        Me.cmbPrdNam = New System.Windows.Forms.ComboBox
        Me.Label3 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label1 = New System.Windows.Forms.Label
        Me.btnFnd = New System.Windows.Forms.Button
        Me.dgdSalList = New System.Windows.Forms.DataGrid
        Me.btnPrt = New System.Windows.Forms.Button
        Me.btnExt = New System.Windows.Forms.Button
        Me.grbCon.SuspendLayout()
        CType(Me.dgdSalList, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'grbCon
        '
        Me.grbCon.Controls.Add(Me.chkEmp)
        Me.grbCon.Controls.Add(Me.chkPrd)
        Me.grbCon.Controls.Add(Me.chkDate)
        Me.grbCon.Controls.Add(Me.txtSalEmp)
        Me.grbCon.Controls.Add(Me.dtpSalDatEnd)
        Me.grbCon.Controls.Add(Me.dtpSalDatFrom)
        Me.grbCon.Controls.Add(Me.Label4)
        Me.grbCon.Controls.Add(Me.cmbPrdNam)
        Me.grbCon.Controls.Add(Me.Label3)
        Me.grbCon.Controls.Add(Me.Label2)
        Me.grbCon.Controls.Add(Me.Label1)
        Me.grbCon.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.grbCon.ForeColor = System.Drawing.Color.Blue
        Me.grbCon.Location = New System.Drawing.Point(20, 166)
        Me.grbCon.Name = "grbCon"
        Me.grbCon.Size = New System.Drawing.Size(745, 170)
        Me.grbCon.TabIndex = 29
        Me.grbCon.TabStop = False
        Me.grbCon.Text = "统计范围(勾选后条件才生效)"
        '
        'chkEmp
        '
        Me.chkEmp.Location = New System.Drawing.Point(40, 129)
        Me.chkEmp.Name = "chkEmp"
        Me.chkEmp.Size = New System.Drawing.Size(16, 16)
        Me.chkEmp.TabIndex = 21
        '
        'chkPrd
        '
        Me.chkPrd.Location = New System.Drawing.Point(40, 85)
        Me.chkPrd.Name = "chkPrd"
        Me.chkPrd.Size = New System.Drawing.Size(16, 16)
        Me.chkPrd.TabIndex = 20
        '
        'chkDate
        '
        Me.chkDate.Location = New System.Drawing.Point(40, 39)
        Me.chkDate.Name = "chkDate"
        Me.chkDate.Size = New System.Drawing.Size(16, 16)
        Me.chkDate.TabIndex = 19
        '
        'txtSalEmp
        '
        Me.txtSalEmp.Location = New System.Drawing.Point(176, 125)
        Me.txtSalEmp.Name = "txtSalEmp"
        Me.txtSalEmp.Size = New System.Drawing.Size(152, 26)
        Me.txtSalEmp.TabIndex = 15
        Me.txtSalEmp.Text = ""
        '
        'dtpSalDatEnd
        '
        Me.dtpSalDatEnd.Location = New System.Drawing.Point(376, 29)
        Me.dtpSalDatEnd.Name = "dtpSalDatEnd"
        Me.dtpSalDatEnd.Size = New System.Drawing.Size(152, 26)
        Me.dtpSalDatEnd.TabIndex = 14
        '
        'dtpSalDatFrom
        '
        Me.dtpSalDatFrom.Location = New System.Drawing.Point(176, 29)
        Me.dtpSalDatFrom.Name = "dtpSalDatFrom"
        Me.dtpSalDatFrom.Size = New System.Drawing.Size(152, 26)
        Me.dtpSalDatFrom.TabIndex = 13
        '
        'Label4
        '
        Me.Label4.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label4.ForeColor = System.Drawing.Color.Black
        Me.Label4.Location = New System.Drawing.Point(336, 35)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(32, 24)
        Me.Label4.TabIndex = 12
        Me.Label4.Text = "至"
        '
        'cmbPrdNam
        '
        Me.cmbPrdNam.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbPrdNam.Location = New System.Drawing.Point(176, 79)
        Me.cmbPrdNam.Name = "cmbPrdNam"
        Me.cmbPrdNam.Size = New System.Drawing.Size(154, 24)
        Me.cmbPrdNam.TabIndex = 5
        '
        'Label3
        '
        Me.Label3.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label3.ForeColor = System.Drawing.Color.Black
        Me.Label3.Location = New System.Drawing.Point(72, 81)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(97, 24)
        Me.Label3.TabIndex = 11
        Me.Label3.Text = "销售商品:"
        '
        'Label2
        '
        Me.Label2.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label2.ForeColor = System.Drawing.Color.Black
        Me.Label2.Location = New System.Drawing.Point(72, 125)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(97, 24)
        Me.Label2.TabIndex = 10
        Me.Label2.Text = "经 手 人:"
        '
        'Label1
        '
        Me.Label1.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label1.ForeColor = System.Drawing.Color.Black
        Me.Label1.Location = New System.Drawing.Point(72, 35)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(97, 24)
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "销售时间:"
        '
        'btnFnd
        '
        Me.btnFnd.Font = New System.Drawing.Font("宋体", 15.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.btnFnd.ForeColor = System.Drawing.Color.Teal
        Me.btnFnd.Location = New System.Drawing.Point(128, 376)
        Me.btnFnd.Name = "btnFnd"
        Me.btnFnd.Size = New System.Drawing.Size(88, 40)
        Me.btnFnd.TabIndex = 32
        Me.btnFnd.Text = "统  计"
        '
        'dgdSalList
        '
        Me.dgdSalList.AlternatingBackColor = System.Drawing.Color.GhostWhite
        Me.dgdSalList.BackColor = System.Drawing.Color.GhostWhite
        Me.dgdSalList.BackgroundColor = System.Drawing.Color.Lavender
        Me.dgdSalList.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.dgdSalList.CaptionBackColor = System.Drawing.Color.RoyalBlue
        Me.dgdSalList.CaptionForeColor = System.Drawing.Color.White
        Me.dgdSalList.CaptionVisible = False
        Me.dgdSalList.DataMember = ""
        Me.dgdSalList.FlatMode = True
        Me.dgdSalList.Font = New System.Drawing.Font("Tahoma", 8.0!)
        Me.dgdSalList.ForeColor = System.Drawing.Color.MidnightBlue
        Me.dgdSalList.GridLineColor = System.Drawing.Color.RoyalBlue
        Me.dgdSalList.HeaderBackColor = System.Drawing.Color.MidnightBlue
        Me.dgdSalList.HeaderFont = New System.Drawing.Font("Tahoma", 8.0!, System.Drawing.FontStyle.Bold)
        Me.dgdSalList.HeaderForeColor = System.Drawing.Color.Lavender
        Me.dgdSalList.LinkColor = System.Drawing.Color.Teal
        Me.dgdSalList.Location = New System.Drawing.Point(44, -2)
        Me.dgdSalList.Name = "dgdSalList"
        Me.dgdSalList.ParentRowsBackColor = System.Drawing.Color.Lavender
        Me.dgdSalList.ParentRowsForeColor = System.Drawing.Color.MidnightBlue
        Me.dgdSalList.ReadOnly = True
        Me.dgdSalList.SelectionBackColor = System.Drawing.Color.Teal
        Me.dgdSalList.SelectionForeColor = System.Drawing.Color.PaleGreen
        Me.dgdSalList.Size = New System.Drawing.Size(605, 157)
        Me.dgdSalList.TabIndex = 30
        '
        'btnPrt
        '
        Me.btnPrt.Font = New System.Drawing.Font("宋体", 15.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.btnPrt.ForeColor = System.Drawing.Color.Teal
        Me.btnPrt.Location = New System.Drawing.Point(328, 376)
        Me.btnPrt.Name = "btnPrt"
        Me.btnPrt.Size = New System.Drawing.Size(88, 40)
        Me.btnPrt.TabIndex = 33
        Me.btnPrt.Text = "打  印"
        '
        'btnExt
        '
        Me.btnExt.Font = New System.Drawing.Font("宋体", 15.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.btnExt.ForeColor = System.Drawing.Color.Teal
        Me.btnExt.Location = New System.Drawing.Point(536, 376)
        Me.btnExt.Name = "btnExt"
        Me.btnExt.Size = New System.Drawing.Size(88, 40)
        Me.btnExt.TabIndex = 31
        Me.btnExt.Text = "退  出"
        '
        'frmStaSal
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(794, 647)
        Me.Controls.Add(Me.grbCon)
        Me.Controls.Add(Me.btnFnd)
        Me.Controls.Add(Me.dgdSalList)
        Me.Controls.Add(Me.btnPrt)
        Me.Controls.Add(Me.btnExt)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "frmStaSal"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "统计销售信息"
        Me.grbCon.ResumeLayout(False)
        CType(Me.dgdSalList, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region
    Dim dbObj As New SCMDB.SCMDB
    Dim stasalObj As New SCMAPP.StaSal
    ' Dim fndCmd As String
    ' Dim selectCmd As String = "Select Sallistid as 销售单编号,prdid as 商品编号,Saldat as 销售日期,Salemp as 经手人, Salqua as 销售数量,Salprc as 销售价格,Salmemo as 销售说明 from Saleproduct"



    Private Sub frmStaSup_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        If Me.Width > 200 Then

            dgdSalList.Left = 5
            dgdSalList.Top = 0
            dgdSalList.Width = Me.Width - 5
            dgdSalList.Height = 3 * Me.Height / 4 - 90
            dgdSalList.RowHeaderWidth = 5
            dgdSalList.PreferredColumnWidth = (dgdSalList.Width - 10) / 7
            grbCon.Left = 15
            grbCon.Top = dgdSalList.Height + 15
            grbCon.Width = Me.Width - 30
            grbCon.Height = Me.Height / 4

            btnFnd.Top = dgdSalList.Height + grbCon.Height + 25


            btnPrt.Top = dgdSalList.Height + grbCon.Height + 25

            btnExt.Top = dgdSalList.Height + grbCon.Height + 25

        End If
        dgdSalList.DataSource = stasalObj.Refresh
        cmbPrdNam.DataSource = dbObj.CreateDataTablebykey("prdname", "productlist")
        cmbPrdNam.DisplayMember = "prdname"
        dtpSalDatFrom.Value = Today.AddDays(-30)
        dtpSalDatEnd.Value = Today
    End Sub

    Private Sub btnFnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFnd.Click
        Dim datFrom, datTo As DateTime
        Dim szProId As String
        Dim szEmp As String
        '日期
        If chkDate.Checked = False Then
            datFrom = Date.Today
            datTo = datFrom       '注意不要写成datto = date.today,会有小概率错误发生
            datFrom.AddTicks(2000)
            datTo.AddTicks(1000)
        Else
            datFrom = dtpSalDatFrom.Value
            datTo = dtpSalDatEnd.Value
        End If
        '商品
        If chkPrd.Checked = False Then
            szProId = ""
        Else
            szProId = Trim(cmbPrdNam.Text)
        End If
        '经手人
        If chkEmp.Checked = False Then
            szEmp = ""
        Else
            szEmp = Trim(txtSalEmp.Text)
        End If
        '开始查询
        dgdSalList.DataSource = stasalObj.Fnd(datFrom, datTo, szProId, szEmp)
    End Sub





    Private Sub btnPrt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrt.Click
        stasalObj.Print()
    End Sub


    Private Sub btnExt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExt.Click
        Me.Close()
    End Sub


    Private Sub dgdSalList_Navigate(ByVal sender As System.Object, ByVal ne As System.Windows.Forms.NavigateEventArgs) Handles dgdSalList.Navigate

    End Sub
End Class

⌨️ 快捷键说明

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