frmMedKcTotal.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:10k
- Public Class frmMedKcTotal
- 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 Panel2 As System.Windows.Forms.Panel
- Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
- Friend WithEvents rboSum As System.Windows.Forms.RadioButton
- Friend WithEvents rboMoney As System.Windows.Forms.RadioButton
- Friend WithEvents rboLr As System.Windows.Forms.RadioButton
- Friend WithEvents ckn As System.Windows.Forms.CheckBox
- Friend WithEvents Label3 As System.Windows.Forms.Label
- Friend WithEvents Label2 As System.Windows.Forms.Label
- Friend WithEvents NumUd As System.Windows.Forms.NumericUpDown
- Friend WithEvents Label1 As System.Windows.Forms.Label
- Friend WithEvents btnPrint As System.Windows.Forms.Button
- Friend WithEvents btnQuery As System.Windows.Forms.Button
- Friend WithEvents Panel1 As System.Windows.Forms.Panel
- Friend WithEvents dgview As System.Windows.Forms.DataGrid
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- Me.Panel2 = New System.Windows.Forms.Panel
- Me.GroupBox1 = New System.Windows.Forms.GroupBox
- Me.btnPrint = New System.Windows.Forms.Button
- Me.btnQuery = New System.Windows.Forms.Button
- Me.rboSum = New System.Windows.Forms.RadioButton
- Me.rboMoney = New System.Windows.Forms.RadioButton
- Me.rboLr = New System.Windows.Forms.RadioButton
- Me.ckn = New System.Windows.Forms.CheckBox
- Me.Label3 = New System.Windows.Forms.Label
- Me.Label2 = New System.Windows.Forms.Label
- Me.NumUd = New System.Windows.Forms.NumericUpDown
- Me.Label1 = New System.Windows.Forms.Label
- Me.Panel1 = New System.Windows.Forms.Panel
- Me.dgview = New System.Windows.Forms.DataGrid
- Me.Panel2.SuspendLayout()
- Me.GroupBox1.SuspendLayout()
- CType(Me.NumUd, System.ComponentModel.ISupportInitialize).BeginInit()
- Me.Panel1.SuspendLayout()
- CType(Me.dgview, System.ComponentModel.ISupportInitialize).BeginInit()
- Me.SuspendLayout()
- '
- 'Panel2
- '
- Me.Panel2.Controls.Add(Me.GroupBox1)
- Me.Panel2.Dock = System.Windows.Forms.DockStyle.Top
- Me.Panel2.Location = New System.Drawing.Point(0, 0)
- Me.Panel2.Name = "Panel2"
- Me.Panel2.Size = New System.Drawing.Size(576, 100)
- Me.Panel2.TabIndex = 4
- '
- 'GroupBox1
- '
- Me.GroupBox1.Controls.Add(Me.btnPrint)
- Me.GroupBox1.Controls.Add(Me.btnQuery)
- Me.GroupBox1.Controls.Add(Me.rboSum)
- Me.GroupBox1.Controls.Add(Me.rboMoney)
- Me.GroupBox1.Controls.Add(Me.rboLr)
- Me.GroupBox1.Controls.Add(Me.ckn)
- Me.GroupBox1.Controls.Add(Me.Label3)
- Me.GroupBox1.Controls.Add(Me.Label2)
- Me.GroupBox1.Controls.Add(Me.NumUd)
- Me.GroupBox1.Controls.Add(Me.Label1)
- Me.GroupBox1.Dock = System.Windows.Forms.DockStyle.Fill
- Me.GroupBox1.Location = New System.Drawing.Point(0, 0)
- Me.GroupBox1.Name = "GroupBox1"
- Me.GroupBox1.Size = New System.Drawing.Size(576, 100)
- Me.GroupBox1.TabIndex = 1
- Me.GroupBox1.TabStop = False
- '
- 'btnPrint
- '
- Me.btnPrint.FlatStyle = System.Windows.Forms.FlatStyle.Popup
- Me.btnPrint.Location = New System.Drawing.Point(480, 48)
- Me.btnPrint.Name = "btnPrint"
- Me.btnPrint.Size = New System.Drawing.Size(80, 23)
- Me.btnPrint.TabIndex = 14
- Me.btnPrint.Text = "打印"
- '
- 'btnQuery
- '
- Me.btnQuery.FlatStyle = System.Windows.Forms.FlatStyle.Popup
- Me.btnQuery.Location = New System.Drawing.Point(480, 24)
- Me.btnQuery.Name = "btnQuery"
- Me.btnQuery.Size = New System.Drawing.Size(80, 23)
- Me.btnQuery.TabIndex = 13
- Me.btnQuery.Text = "统计"
- '
- 'rboSum
- '
- Me.rboSum.Location = New System.Drawing.Point(192, 50)
- Me.rboSum.Name = "rboSum"
- Me.rboSum.Size = New System.Drawing.Size(72, 24)
- Me.rboSum.TabIndex = 12
- Me.rboSum.Text = "库存数量"
- '
- 'rboMoney
- '
- Me.rboMoney.Location = New System.Drawing.Point(120, 50)
- Me.rboMoney.Name = "rboMoney"
- Me.rboMoney.Size = New System.Drawing.Size(72, 24)
- Me.rboMoney.TabIndex = 11
- Me.rboMoney.Text = "库存金额"
- '
- 'rboLr
- '
- Me.rboLr.Location = New System.Drawing.Point(66, 50)
- Me.rboLr.Name = "rboLr"
- Me.rboLr.Size = New System.Drawing.Size(64, 24)
- Me.rboLr.TabIndex = 10
- Me.rboLr.Text = "毛利润"
- '
- 'ckn
- '
- Me.ckn.Location = New System.Drawing.Point(88, 16)
- Me.ckn.Name = "ckn"
- Me.ckn.Size = New System.Drawing.Size(184, 24)
- Me.ckn.TabIndex = 9
- Me.ckn.Text = "选中为正数,不选中为倒数!"
- '
- 'Label3
- '
- Me.Label3.AutoSize = True
- Me.Label3.Location = New System.Drawing.Point(8, 56)
- Me.Label3.Name = "Label3"
- Me.Label3.Size = New System.Drawing.Size(66, 17)
- Me.Label3.TabIndex = 5
- Me.Label3.Text = "排行标准:"
- '
- 'Label2
- '
- Me.Label2.AutoSize = True
- Me.Label2.Location = New System.Drawing.Point(64, 24)
- Me.Label2.Name = "Label2"
- Me.Label2.Size = New System.Drawing.Size(17, 17)
- Me.Label2.TabIndex = 2
- Me.Label2.Text = "位"
- '
- 'NumUd
- '
- Me.NumUd.Location = New System.Drawing.Point(24, 16)
- Me.NumUd.Name = "NumUd"
- Me.NumUd.Size = New System.Drawing.Size(40, 21)
- Me.NumUd.TabIndex = 1
- Me.NumUd.Value = New Decimal(New Integer() {10, 0, 0, 0})
- '
- 'Label1
- '
- Me.Label1.AutoSize = True
- Me.Label1.Location = New System.Drawing.Point(8, 24)
- Me.Label1.Name = "Label1"
- Me.Label1.Size = New System.Drawing.Size(17, 17)
- Me.Label1.TabIndex = 0
- Me.Label1.Text = "前"
- '
- 'Panel1
- '
- Me.Panel1.Controls.Add(Me.dgview)
- Me.Panel1.Dock = System.Windows.Forms.DockStyle.Fill
- Me.Panel1.Location = New System.Drawing.Point(0, 100)
- Me.Panel1.Name = "Panel1"
- Me.Panel1.Size = New System.Drawing.Size(576, 255)
- Me.Panel1.TabIndex = 5
- '
- 'dgview
- '
- Me.dgview.DataMember = ""
- Me.dgview.Dock = System.Windows.Forms.DockStyle.Fill
- Me.dgview.HeaderForeColor = System.Drawing.SystemColors.ControlText
- Me.dgview.Location = New System.Drawing.Point(0, 0)
- Me.dgview.Name = "dgview"
- Me.dgview.Size = New System.Drawing.Size(576, 255)
- Me.dgview.TabIndex = 0
- '
- 'frmMedKcTotal
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
- Me.ClientSize = New System.Drawing.Size(576, 355)
- Me.Controls.Add(Me.Panel1)
- Me.Controls.Add(Me.Panel2)
- Me.Name = "frmMedKcTotal"
- Me.Text = "库存药品排行表"
- Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
- Me.Panel2.ResumeLayout(False)
- Me.GroupBox1.ResumeLayout(False)
- CType(Me.NumUd, System.ComponentModel.ISupportInitialize).EndInit()
- Me.Panel1.ResumeLayout(False)
- CType(Me.dgview, System.ComponentModel.ISupportInitialize).EndInit()
- Me.ResumeLayout(False)
- End Sub
- #End Region
- Public lsweb As New jxcmanage
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
-
- End Sub
- Private Sub frmMedKcTotal_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- End Sub
- Private Sub btnQuery_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuery.Click
- Dim strorder As String
- Dim strquery As String
- Dim strqueryes As String
- If ckn.Checked Then
- If rboLr.Checked Then
- strquery = "毛利润"
- End If
- If rboMoney.Checked Then
- strquery = "库存金额"
- End If
- If rboSum.Checked Then
- strquery = "库存数量"
- End If
- strorder = " order by " & strquery & " desc"
- Else
- If rboLr.Checked Then
- strquery = "毛利润"
- End If
- If rboMoney.Checked Then
- strquery = "库存金额"
- End If
- If rboSum.Checked Then
- strquery = "库存数量"
- End If
- strorder = " order by " & strquery
- End If
- strqueryes = "select top " & NumUd.Value & " a.药品编号,a.药品名称,a.药品规格,a.单位,a.包装,sum(isnull(a.数量,0)) as 库存数量,sum(isnull(a.金额,0)) as 库存金额,sum((isnull(b.售价,0)-isnull(a.进价,0))*isnull(a.数量,0)) as 毛利润,a.产地 from wz_kc a,wz_cp b where a.药品编号=b.药品编号 group by a.药品编号,a.药品名称,a.药品规格,a.单位,a.包装,a.产地" & strorder
- If rboMoney.Checked = False And rboSum.Checked = False And rboLr.Checked = False Then
- MessageBox.Show("请设置查询条件!", "提示!", MessageBoxButtons.OK)
- Else
- Dim dv As DataView
- Dim dtOrder As DataTable = lsweb.runSql(strqueryes).Tables(0)
- dv = dtOrder.DefaultView
- dgview.DataSource = dv
- End If
- End Sub
- End Class