📄 frmstapur.vb
字号:
Public Class frmStaPur
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 dtpPurDatEnd As System.Windows.Forms.DateTimePicker
Friend WithEvents dtpPurDatFrom As System.Windows.Forms.DateTimePicker
Friend WithEvents cmbSupNam As System.Windows.Forms.ComboBox
Friend WithEvents cmbPrdNam As System.Windows.Forms.ComboBox
Friend WithEvents dgdPurList As System.Windows.Forms.DataGrid
Friend WithEvents chkPrd As System.Windows.Forms.CheckBox
Friend WithEvents chkDate As System.Windows.Forms.CheckBox
Friend WithEvents chkSup As System.Windows.Forms.CheckBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmStaPur))
Me.grbCon = New System.Windows.Forms.GroupBox
Me.dtpPurDatEnd = New System.Windows.Forms.DateTimePicker
Me.dtpPurDatFrom = New System.Windows.Forms.DateTimePicker
Me.Label4 = New System.Windows.Forms.Label
Me.cmbSupNam = New System.Windows.Forms.ComboBox
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.dgdPurList = New System.Windows.Forms.DataGrid
Me.btnPrt = New System.Windows.Forms.Button
Me.btnExt = New System.Windows.Forms.Button
Me.chkSup = New System.Windows.Forms.CheckBox
Me.chkPrd = New System.Windows.Forms.CheckBox
Me.chkDate = New System.Windows.Forms.CheckBox
Me.grbCon.SuspendLayout()
CType(Me.dgdPurList, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'grbCon
'
Me.grbCon.Controls.Add(Me.chkSup)
Me.grbCon.Controls.Add(Me.chkPrd)
Me.grbCon.Controls.Add(Me.chkDate)
Me.grbCon.Controls.Add(Me.dtpPurDatEnd)
Me.grbCon.Controls.Add(Me.dtpPurDatFrom)
Me.grbCon.Controls.Add(Me.Label4)
Me.grbCon.Controls.Add(Me.cmbSupNam)
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 = "统计范围(勾选后条件才生效)"
'
'dtpPurDatEnd
'
Me.dtpPurDatEnd.Location = New System.Drawing.Point(376, 29)
Me.dtpPurDatEnd.Name = "dtpPurDatEnd"
Me.dtpPurDatEnd.Size = New System.Drawing.Size(152, 26)
Me.dtpPurDatEnd.TabIndex = 14
'
'dtpPurDatFrom
'
Me.dtpPurDatFrom.Location = New System.Drawing.Point(176, 29)
Me.dtpPurDatFrom.Name = "dtpPurDatFrom"
Me.dtpPurDatFrom.Size = New System.Drawing.Size(152, 26)
Me.dtpPurDatFrom.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 = "至"
'
'cmbSupNam
'
Me.cmbSupNam.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cmbSupNam.Location = New System.Drawing.Point(176, 123)
Me.cmbSupNam.Name = "cmbSupNam"
Me.cmbSupNam.Size = New System.Drawing.Size(154, 24)
Me.cmbSupNam.TabIndex = 7
'
'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, 368)
Me.btnFnd.Name = "btnFnd"
Me.btnFnd.Size = New System.Drawing.Size(88, 40)
Me.btnFnd.TabIndex = 32
Me.btnFnd.Text = "统 计"
'
'dgdPurList
'
Me.dgdPurList.AlternatingBackColor = System.Drawing.Color.GhostWhite
Me.dgdPurList.BackColor = System.Drawing.Color.GhostWhite
Me.dgdPurList.BackgroundColor = System.Drawing.Color.Lavender
Me.dgdPurList.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.dgdPurList.CaptionBackColor = System.Drawing.Color.RoyalBlue
Me.dgdPurList.CaptionForeColor = System.Drawing.Color.White
Me.dgdPurList.CaptionVisible = False
Me.dgdPurList.DataMember = ""
Me.dgdPurList.FlatMode = True
Me.dgdPurList.Font = New System.Drawing.Font("Tahoma", 8.0!)
Me.dgdPurList.ForeColor = System.Drawing.Color.MidnightBlue
Me.dgdPurList.GridLineColor = System.Drawing.Color.RoyalBlue
Me.dgdPurList.HeaderBackColor = System.Drawing.Color.MidnightBlue
Me.dgdPurList.HeaderFont = New System.Drawing.Font("Tahoma", 8.0!, System.Drawing.FontStyle.Bold)
Me.dgdPurList.HeaderForeColor = System.Drawing.Color.Lavender
Me.dgdPurList.LinkColor = System.Drawing.Color.Teal
Me.dgdPurList.Location = New System.Drawing.Point(72, 8)
Me.dgdPurList.Name = "dgdPurList"
Me.dgdPurList.ParentRowsBackColor = System.Drawing.Color.Lavender
Me.dgdPurList.ParentRowsForeColor = System.Drawing.Color.MidnightBlue
Me.dgdPurList.ReadOnly = True
Me.dgdPurList.SelectionBackColor = System.Drawing.Color.Teal
Me.dgdPurList.SelectionForeColor = System.Drawing.Color.PaleGreen
Me.dgdPurList.Size = New System.Drawing.Size(605, 157)
Me.dgdPurList.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(336, 368)
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, 368)
Me.btnExt.Name = "btnExt"
Me.btnExt.Size = New System.Drawing.Size(88, 40)
Me.btnExt.TabIndex = 31
Me.btnExt.Text = "退 出"
'
'chkSup
'
Me.chkSup.Location = New System.Drawing.Point(32, 129)
Me.chkSup.Name = "chkSup"
Me.chkSup.Size = New System.Drawing.Size(16, 16)
Me.chkSup.TabIndex = 21
'
'chkPrd
'
Me.chkPrd.Location = New System.Drawing.Point(32, 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(32, 39)
Me.chkDate.Name = "chkDate"
Me.chkDate.Size = New System.Drawing.Size(16, 16)
Me.chkDate.TabIndex = 19
'
'frmStaPur
'
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.dgdPurList)
Me.Controls.Add(Me.btnPrt)
Me.Controls.Add(Me.btnExt)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmStaPur"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "统计采购信息"
Me.grbCon.ResumeLayout(False)
CType(Me.dgdPurList, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
'定义SCMDB对象
Dim dbObj As New SCMDB.SCMDB
'定义StaPur对象
Dim stapurObj As New SCMAPP.StaPur
Private Sub frmStaPur_Load(ByVal sender As System.Object, ByVal e _
As System.EventArgs) Handles MyBase.Load
'设置窗体内控件的大小和位置
If Me.Width > 200 Then
dgdPurList.Left = 5
dgdPurList.Top = 0
dgdPurList.Width = Me.Width - 5
dgdPurList.Height = 3 * Me.Height / 4 - 90
dgdPurList.RowHeaderWidth = 5
dgdPurList.PreferredColumnWidth = (dgdPurList.Width - 10) / 8
grbCon.Left = 15
grbCon.Top = dgdPurList.Height + 15
grbCon.Width = Me.Width - 30
grbCon.Height = Me.Height / 4
btnFnd.Top = dgdPurList.Height + grbCon.Height + 25
btnPrt.Top = dgdPurList.Height + grbCon.Height + 25
btnExt.Top = dgdPurList.Height + grbCon.Height + 25
End If
'设置表格数据源
dgdPurList.DataSource = stapurObj.Refresh
'设置组合框的数据绑定
cmbPrdNam.DataSource = dbObj.CreateDataTableByKey("prdname", "productlist")
cmbPrdNam.DisplayMember = "prdname"
cmbSupNam.DataSource = dbObj.CreateDataTableByKey("supname", "supplierlist")
cmbSupNam.DisplayMember = "supname"
'设定日期控件的缺省值
dtpPurDatFrom.Value = Today.AddDays(-30)
dtpPurDatEnd.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 szSup As String
'日期
If chkDate.Checked = False Then
datFrom = Date.Today
datTo = datFrom '注意不要写成datto = date.today,会有小概率错误发生
datFrom.AddTicks(2000)
datTo.AddTicks(1000)
Else
datFrom = dtpPurDatFrom.Value
datTo = dtpPurDatEnd.Value
End If
'商品
If chkPrd.Checked = False Then
szProId = ""
Else
szProId = Trim(cmbPrdNam.Text)
End If
'经手人
If chkSup.Checked = False Then
szSup = ""
Else
szSup = Trim(cmbSupNam.Text)
End If
'开始查询
dgdPurList.DataSource = stapurObj.Fnd(datFrom, datTo, szProId, szSup)
End Sub
Private Sub btnPrt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrt.Click
stapurObj.Print()
End Sub
Private Sub btnExt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExt.Click
Me.Close()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -