frmCKPHTotal.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:13k
- Public Class frmCKPHTotal
- Inherits System.Windows.Forms.Form
- Public lsweb As New jxcmanage
- #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 GroupBox2 As System.Windows.Forms.GroupBox
- Friend WithEvents btnPrint As System.Windows.Forms.Button
- Friend WithEvents btnQuery As System.Windows.Forms.Button
- 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 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 GroupBox3 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 GroupBox4 As System.Windows.Forms.GroupBox
- Friend WithEvents dgview As System.Windows.Forms.DataGrid
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- Me.GroupBox2 = New System.Windows.Forms.GroupBox
- Me.btnPrint = New System.Windows.Forms.Button
- Me.btnQuery = New System.Windows.Forms.Button
- Me.GroupBox1 = New System.Windows.Forms.GroupBox
- 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.GroupBox3 = 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.GroupBox4 = New System.Windows.Forms.GroupBox
- Me.dgview = New System.Windows.Forms.DataGrid
- Me.GroupBox2.SuspendLayout()
- Me.GroupBox1.SuspendLayout()
- CType(Me.NumUd, System.ComponentModel.ISupportInitialize).BeginInit()
- Me.GroupBox3.SuspendLayout()
- Me.tabtable.SuspendLayout()
- Me.GroupBox4.SuspendLayout()
- CType(Me.dgview, System.ComponentModel.ISupportInitialize).BeginInit()
- Me.SuspendLayout()
- '
- 'GroupBox2
- '
- Me.GroupBox2.Controls.Add(Me.btnPrint)
- Me.GroupBox2.Controls.Add(Me.btnQuery)
- Me.GroupBox2.Dock = System.Windows.Forms.DockStyle.Right
- Me.GroupBox2.Location = New System.Drawing.Point(480, 80)
- Me.GroupBox2.Name = "GroupBox2"
- Me.GroupBox2.Size = New System.Drawing.Size(96, 293)
- Me.GroupBox2.TabIndex = 8
- Me.GroupBox2.TabStop = False
- '
- 'btnPrint
- '
- Me.btnPrint.FlatStyle = System.Windows.Forms.FlatStyle.Popup
- Me.btnPrint.Location = New System.Drawing.Point(8, 48)
- Me.btnPrint.Name = "btnPrint"
- Me.btnPrint.TabIndex = 1
- Me.btnPrint.Text = "打印"
- '
- 'btnQuery
- '
- Me.btnQuery.FlatStyle = System.Windows.Forms.FlatStyle.Popup
- Me.btnQuery.Location = New System.Drawing.Point(8, 17)
- Me.btnQuery.Name = "btnQuery"
- Me.btnQuery.TabIndex = 0
- Me.btnQuery.Text = "统计"
- '
- 'GroupBox1
- '
- 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(576, 80)
- Me.GroupBox1.TabIndex = 7
- Me.GroupBox1.TabStop = False
- '
- '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(84, 19)
- Me.ckn.Name = "ckn"
- Me.ckn.Size = New System.Drawing.Size(185, 23)
- 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 = "前"
- '
- 'GroupBox3
- '
- Me.GroupBox3.Controls.Add(Me.tabtable)
- Me.GroupBox3.Dock = System.Windows.Forms.DockStyle.Top
- Me.GroupBox3.Location = New System.Drawing.Point(0, 80)
- Me.GroupBox3.Name = "GroupBox3"
- Me.GroupBox3.Size = New System.Drawing.Size(480, 48)
- Me.GroupBox3.TabIndex = 10
- Me.GroupBox3.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.Fill
- Me.tabtable.Location = New System.Drawing.Point(3, 17)
- Me.tabtable.Name = "tabtable"
- Me.tabtable.SelectedIndex = 0
- Me.tabtable.Size = New System.Drawing.Size(474, 28)
- Me.tabtable.TabIndex = 11
- '
- 'tabmed
- '
- Me.tabmed.Location = New System.Drawing.Point(4, 24)
- Me.tabmed.Name = "tabmed"
- Me.tabmed.Size = New System.Drawing.Size(466, 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(472, 0)
- Me.tbkh.TabIndex = 1
- Me.tbkh.Text = "按客户名称"
- Me.tbkh.Visible = False
- '
- 'GroupBox4
- '
- Me.GroupBox4.Controls.Add(Me.dgview)
- Me.GroupBox4.Dock = System.Windows.Forms.DockStyle.Fill
- Me.GroupBox4.Location = New System.Drawing.Point(0, 128)
- Me.GroupBox4.Name = "GroupBox4"
- Me.GroupBox4.Size = New System.Drawing.Size(480, 245)
- Me.GroupBox4.TabIndex = 11
- Me.GroupBox4.TabStop = False
- '
- '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(3, 17)
- Me.dgview.Name = "dgview"
- Me.dgview.Size = New System.Drawing.Size(474, 225)
- Me.dgview.TabIndex = 10
- '
- 'frmCKPHTotal
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
- Me.ClientSize = New System.Drawing.Size(576, 373)
- Me.Controls.Add(Me.GroupBox4)
- Me.Controls.Add(Me.GroupBox3)
- Me.Controls.Add(Me.GroupBox2)
- Me.Controls.Add(Me.GroupBox1)
- Me.Name = "frmCKPHTotal"
- Me.Text = "frmCKPHTotal"
- Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
- Me.GroupBox2.ResumeLayout(False)
- Me.GroupBox1.ResumeLayout(False)
- CType(Me.NumUd, System.ComponentModel.ISupportInitialize).EndInit()
- Me.GroupBox3.ResumeLayout(False)
- Me.tabtable.ResumeLayout(False)
- Me.GroupBox4.ResumeLayout(False)
- CType(Me.dgview, System.ComponentModel.ISupportInitialize).EndInit()
- Me.ResumeLayout(False)
- End Sub
- #End Region
- Private Sub btnQuery_Click(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_ck 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_ck 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