frmviewkcmanage.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:9k
- Imports System.Configuration
- Public Class frmviewkcmanage
- 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 Label1 As System.Windows.Forms.Label
- Friend WithEvents Button2 As System.Windows.Forms.Button
- Friend WithEvents CheckBox7 As System.Windows.Forms.CheckBox
- Friend WithEvents CheckBox6 As System.Windows.Forms.CheckBox
- Friend WithEvents CheckBox5 As System.Windows.Forms.CheckBox
- Friend WithEvents CheckBox4 As System.Windows.Forms.CheckBox
- Friend WithEvents CheckBox3 As System.Windows.Forms.CheckBox
- Friend WithEvents CheckBox2 As System.Windows.Forms.CheckBox
- Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
- Friend WithEvents kcViewer As DataDynamics.ActiveReports.Viewer.Viewer
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- Me.kcViewer = New DataDynamics.ActiveReports.Viewer.Viewer
- Me.Label1 = New System.Windows.Forms.Label
- Me.Button2 = New System.Windows.Forms.Button
- Me.CheckBox7 = New System.Windows.Forms.CheckBox
- Me.CheckBox6 = New System.Windows.Forms.CheckBox
- Me.CheckBox5 = New System.Windows.Forms.CheckBox
- Me.CheckBox4 = New System.Windows.Forms.CheckBox
- Me.CheckBox3 = New System.Windows.Forms.CheckBox
- Me.CheckBox2 = New System.Windows.Forms.CheckBox
- Me.CheckBox1 = New System.Windows.Forms.CheckBox
- Me.SuspendLayout()
- '
- 'kcViewer
- '
- Me.kcViewer.BackColor = System.Drawing.SystemColors.Control
- Me.kcViewer.Dock = System.Windows.Forms.DockStyle.Bottom
- Me.kcViewer.Location = New System.Drawing.Point(0, 29)
- Me.kcViewer.Name = "kcViewer"
- Me.kcViewer.ReportViewer.CurrentPage = 0
- Me.kcViewer.ReportViewer.MultiplePageCols = 3
- Me.kcViewer.ReportViewer.MultiplePageRows = 2
- Me.kcViewer.Size = New System.Drawing.Size(1024, 696)
- Me.kcViewer.TabIndex = 0
- Me.kcViewer.TableOfContents.Text = "Contents"
- Me.kcViewer.TableOfContents.Width = 200
- Me.kcViewer.Toolbar.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
- '
- 'Label1
- '
- Me.Label1.AutoSize = True
- Me.Label1.Location = New System.Drawing.Point(8, 8)
- Me.Label1.Name = "Label1"
- Me.Label1.Size = New System.Drawing.Size(103, 17)
- Me.Label1.TabIndex = 28
- Me.Label1.Text = "按药品类别打印:"
- '
- 'Button2
- '
- Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Popup
- Me.Button2.Location = New System.Drawing.Point(600, 0)
- Me.Button2.Name = "Button2"
- Me.Button2.TabIndex = 27
- Me.Button2.Text = "确定"
- '
- 'CheckBox7
- '
- Me.CheckBox7.Location = New System.Drawing.Point(512, 0)
- Me.CheckBox7.Name = "CheckBox7"
- Me.CheckBox7.TabIndex = 26
- Me.CheckBox7.Text = "Q:医疗器械"
- '
- 'CheckBox6
- '
- Me.CheckBox6.Location = New System.Drawing.Point(440, 0)
- Me.CheckBox6.Name = "CheckBox6"
- Me.CheckBox6.TabIndex = 25
- Me.CheckBox6.Text = "B:保健品"
- '
- 'CheckBox5
- '
- Me.CheckBox5.Location = New System.Drawing.Point(360, 0)
- Me.CheckBox5.Name = "CheckBox5"
- Me.CheckBox5.TabIndex = 24
- Me.CheckBox5.Text = "K:糖浆剂型"
- '
- 'CheckBox4
- '
- Me.CheckBox4.Location = New System.Drawing.Point(304, 0)
- Me.CheckBox4.Name = "CheckBox4"
- Me.CheckBox4.TabIndex = 23
- Me.CheckBox4.Text = "F:粉剂"
- '
- 'CheckBox3
- '
- Me.CheckBox3.Location = New System.Drawing.Point(224, 0)
- Me.CheckBox3.Name = "CheckBox3"
- Me.CheckBox3.TabIndex = 22
- Me.CheckBox3.Text = "W:外用剂型"
- '
- 'CheckBox2
- '
- Me.CheckBox2.Location = New System.Drawing.Point(168, 0)
- Me.CheckBox2.Name = "CheckBox2"
- Me.CheckBox2.TabIndex = 21
- Me.CheckBox2.Text = "Z:针剂"
- '
- 'CheckBox1
- '
- Me.CheckBox1.Location = New System.Drawing.Point(112, 0)
- Me.CheckBox1.Name = "CheckBox1"
- Me.CheckBox1.TabIndex = 20
- Me.CheckBox1.Text = "P:片剂"
- '
- 'frmviewkcmanage
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
- Me.ClientSize = New System.Drawing.Size(1024, 725)
- Me.Controls.Add(Me.Label1)
- Me.Controls.Add(Me.Button2)
- Me.Controls.Add(Me.CheckBox7)
- Me.Controls.Add(Me.CheckBox6)
- Me.Controls.Add(Me.CheckBox5)
- Me.Controls.Add(Me.CheckBox4)
- Me.Controls.Add(Me.CheckBox3)
- Me.Controls.Add(Me.CheckBox2)
- Me.Controls.Add(Me.CheckBox1)
- Me.Controls.Add(Me.kcViewer)
- Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
- Me.Name = "frmviewkcmanage"
- Me.Text = "frmviewkcmanage"
- Me.ResumeLayout(False)
- End Sub
- #End Region
- Public sqlString As String
- Private Sub frmviewkcmanage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- If sqlString <> String.Empty Then
- Try
- Dim rpt As New rpxkc
- Dim myDS As New DataDynamics.ActiveReports.DataSources.SqlDBDataSource
- myDS.ConnectionString = ConfigurationSettings.AppSettings.Get("constr")
- myDS.SQL = sqlString
- rpt.DataSource = myDS
- Me.kcViewer.Document = rpt.Document
- rpt.Run()
- Catch ex As Exception
- MessageBox.Show(Me, "报表错误: " + ex.Message + "; " + ex.InnerException.Message, "Report Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- End Try
- End If
- End Sub
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- Dim strquery As String
- strquery = "select * from wz_kc where 药品编号 not like '%'"
- If CheckBox1.Checked = True Then
- strquery = strquery & " or 药品编号 like 'P%'"
- End If
- If CheckBox2.Checked = True Then
- strquery = strquery & " or 药品编号 like 'Z%'"
- End If
- If CheckBox3.Checked = True Then
- strquery = strquery & " or 药品编号 like 'W%'"
- End If
- If CheckBox4.Checked = True Then
- strquery = strquery & " or 药品编号 like 'F%'"
- End If
- If CheckBox5.Checked = True Then
- strquery = strquery & " or 药品编号 like 'K%'"
- End If
- If CheckBox6.Checked = True Then
- strquery = strquery & " or 药品编号 like 'B%'"
- End If
- If CheckBox7.Checked = True Then
- strquery = strquery & " or 药品编号 like 'Q%'"
- End If
- If strquery = String.Empty Then
- Try
- Dim rpt As New rpxkc
- Dim myDS As New DataDynamics.ActiveReports.DataSources.SqlDBDataSource
- myDS.ConnectionString = ConfigurationSettings.AppSettings.Get("constr")
- myDS.SQL = "select * from wz_kc"
- rpt.DataSource = myDS
- Me.kcViewer.Document = rpt.Document
- rpt.Run()
- Catch ex As Exception
- MessageBox.Show(Me, "报表错误: " + ex.Message + "; " + ex.InnerException.Message, "Report Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- End Try
- Else
- Try
- Dim rpt As New rpxkc
- Dim myDS As New DataDynamics.ActiveReports.DataSources.SqlDBDataSource
- myDS.ConnectionString = ConfigurationSettings.AppSettings.Get("constr")
- myDS.SQL = strquery
- rpt.DataSource = myDS
- Me.kcViewer.Document = rpt.Document
- rpt.Run(False)
- Catch ex As Exception
- MessageBox.Show(Me, "报表错误: " + ex.Message + "; " + ex.InnerException.Message, "Report Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- End Try
- End If
- End Sub
- End Class