frmRkPhTotal.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:13k
- Public Class frmRkPhTotal
- 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 GroupBox1 As System.Windows.Forms.GroupBox
- 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 rboSum As System.Windows.Forms.RadioButton
- Friend WithEvents rboMoney As System.Windows.Forms.RadioButton
- Friend WithEvents btnPrint As System.Windows.Forms.Button
- Friend WithEvents btnQuery As System.Windows.Forms.Button
- Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
- Friend WithEvents tabtable As System.Windows.Forms.TabControl
- Friend WithEvents tabmed As System.Windows.Forms.TabPage
- Friend WithEvents tbkh As System.Windows.Forms.TabPage
- Friend WithEvents Panel1 As System.Windows.Forms.Panel
- Friend WithEvents dgview As System.Windows.Forms.DataGrid
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- 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.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.GroupBox2 = New System.Windows.Forms.GroupBox
- Me.tabtable = New System.Windows.Forms.TabControl
- Me.tabmed = New System.Windows.Forms.TabPage
- Me.tbkh = New System.Windows.Forms.TabPage
- Me.Panel1 = New System.Windows.Forms.Panel
- Me.dgview = New System.Windows.Forms.DataGrid
- Me.GroupBox1.SuspendLayout()
- CType(Me.NumUd, System.ComponentModel.ISupportInitialize).BeginInit()
- Me.GroupBox2.SuspendLayout()
- Me.tabtable.SuspendLayout()
- Me.Panel1.SuspendLayout()
- CType(Me.dgview, System.ComponentModel.ISupportInitialize).BeginInit()
- Me.SuspendLayout()
- '
- '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.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.Top
- Me.GroupBox1.Location = New System.Drawing.Point(0, 0)
- Me.GroupBox1.Name = "GroupBox1"
- Me.GroupBox1.Size = New System.Drawing.Size(648, 80)
- Me.GroupBox1.TabIndex = 3
- Me.GroupBox1.TabStop = False
- '
- 'btnPrint
- '
- Me.btnPrint.FlatStyle = System.Windows.Forms.FlatStyle.Popup
- Me.btnPrint.Location = New System.Drawing.Point(544, 48)
- Me.btnPrint.Name = "btnPrint"
- Me.btnPrint.TabIndex = 13
- Me.btnPrint.Text = "打印"
- '
- 'btnQuery
- '
- Me.btnQuery.FlatStyle = System.Windows.Forms.FlatStyle.Popup
- Me.btnQuery.Location = New System.Drawing.Point(544, 24)
- Me.btnQuery.Name = "btnQuery"
- Me.btnQuery.TabIndex = 12
- Me.btnQuery.Text = "统计"
- '
- 'rboSum
- '
- Me.rboSum.Location = New System.Drawing.Point(150, 50)
- Me.rboSum.Name = "rboSum"
- Me.rboSum.Size = New System.Drawing.Size(72, 24)
- Me.rboSum.TabIndex = 11
- Me.rboSum.Text = "采购数量"
- '
- 'rboMoney
- '
- Me.rboMoney.Location = New System.Drawing.Point(78, 50)
- Me.rboMoney.Name = "rboMoney"
- Me.rboMoney.Size = New System.Drawing.Size(72, 24)
- Me.rboMoney.TabIndex = 10
- Me.rboMoney.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 = "前"
- '
- 'GroupBox2
- '
- Me.GroupBox2.Controls.Add(Me.tabtable)
- Me.GroupBox2.Dock = System.Windows.Forms.DockStyle.Top
- Me.GroupBox2.Location = New System.Drawing.Point(0, 80)
- Me.GroupBox2.Name = "GroupBox2"
- Me.GroupBox2.Size = New System.Drawing.Size(648, 48)
- Me.GroupBox2.TabIndex = 8
- Me.GroupBox2.TabStop = False
- '
- 'tabtable
- '
- Me.tabtable.Appearance = System.Windows.Forms.TabAppearance.FlatButtons
- Me.tabtable.Controls.Add(Me.tabmed)
- Me.tabtable.Controls.Add(Me.tbkh)
- Me.tabtable.Dock = System.Windows.Forms.DockStyle.Top
- Me.tabtable.Location = New System.Drawing.Point(3, 17)
- Me.tabtable.Name = "tabtable"
- Me.tabtable.SelectedIndex = 0
- Me.tabtable.Size = New System.Drawing.Size(642, 24)
- Me.tabtable.TabIndex = 8
- '
- 'tabmed
- '
- Me.tabmed.Location = New System.Drawing.Point(4, 24)
- Me.tabmed.Name = "tabmed"
- Me.tabmed.Size = New System.Drawing.Size(634, 0)
- Me.tabmed.TabIndex = 0
- Me.tabmed.Text = "按药品品种"
- '
- 'tbkh
- '
- Me.tbkh.Location = New System.Drawing.Point(4, 24)
- Me.tbkh.Name = "tbkh"
- Me.tbkh.Size = New System.Drawing.Size(634, -4)
- Me.tbkh.TabIndex = 1
- Me.tbkh.Text = "按供应商"
- Me.tbkh.Visible = False
- '
- 'Panel1
- '
- Me.Panel1.Controls.Add(Me.dgview)
- Me.Panel1.Dock = System.Windows.Forms.DockStyle.Fill
- Me.Panel1.Location = New System.Drawing.Point(0, 128)
- Me.Panel1.Name = "Panel1"
- Me.Panel1.Size = New System.Drawing.Size(648, 349)
- Me.Panel1.TabIndex = 9
- '
- '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(648, 349)
- Me.dgview.TabIndex = 6
- '
- 'frmRkPhTotal
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
- Me.ClientSize = New System.Drawing.Size(648, 477)
- Me.Controls.Add(Me.Panel1)
- Me.Controls.Add(Me.GroupBox2)
- Me.Controls.Add(Me.GroupBox1)
- Me.Name = "frmRkPhTotal"
- Me.Text = "frmRkPhTotal"
- Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
- Me.GroupBox1.ResumeLayout(False)
- CType(Me.NumUd, System.ComponentModel.ISupportInitialize).EndInit()
- Me.GroupBox2.ResumeLayout(False)
- Me.tabtable.ResumeLayout(False)
- 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 frmRkPhTotal_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)
-
- End Sub
- Private Sub btnQuery_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuery.Click
- Select Case tabtable.SelectedTab.Text
- Case "按药品品种"
- Dim strorder As String
- Dim strquery As String
- Dim strqueryes As String
- If ckn.Checked Then
- If rboMoney.Checked Then
- strquery = "采购金额"
- End If
- If rboSum.Checked Then
- strquery = "采购数量"
- End If
- strorder = " order by " & strquery & " desc"
- Else
- 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 & " 药品编号,药品名称,药品规格,单位,包装,sum(isnull(数量,0)) as 采购数量,sum(isnull(金额,0)) as 采购金额,产地 from wz_rk group by 药品编号,药品名称,药品规格,单位,包装,产地" & strorder
- If rboMoney.Checked = False And rboSum.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
- Case "按供应商"
- Dim strorder As String
- Dim strquery As String
- Dim strqueryes As String
- If ckn.Checked Then
- If rboMoney.Checked Then
- strquery = "采购金额"
- End If
- If rboSum.Checked Then
- strquery = "采购数量"
- End If
- strorder = " order by " & strquery & " desc"
- Else
- 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 & " 客户名称,sum(isnull(数量,0)) as 采购数量,sum(isnull(金额,0)) as 采购金额 from wz_rk group by 客户名称" & strorder
- If rboMoney.Checked = False And rboSum.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 Select
- End Sub
- End Class