frmrkmanage.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:10k
- Public Class frmrkmanage
- 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 ToolBar1 As System.Windows.Forms.ToolBar
- Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar
- Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
- Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
- Friend WithEvents DateTimePicker1 As System.Windows.Forms.DateTimePicker
- Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
- Friend WithEvents tbrmodify As System.Windows.Forms.ToolBarButton
- Friend WithEvents tbrdelete As System.Windows.Forms.ToolBarButton
- Friend WithEvents tbrprint As System.Windows.Forms.ToolBarButton
- Friend WithEvents tbrexit As System.Windows.Forms.ToolBarButton
- Friend WithEvents dgrkmanage As System.Windows.Forms.DataGrid
- Friend WithEvents tbrfash As System.Windows.Forms.ToolBarButton
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- Me.ToolBar1 = New System.Windows.Forms.ToolBar
- Me.tbrmodify = New System.Windows.Forms.ToolBarButton
- Me.tbrdelete = New System.Windows.Forms.ToolBarButton
- Me.tbrfash = New System.Windows.Forms.ToolBarButton
- Me.tbrprint = New System.Windows.Forms.ToolBarButton
- Me.tbrexit = New System.Windows.Forms.ToolBarButton
- Me.StatusBar1 = New System.Windows.Forms.StatusBar
- Me.GroupBox1 = New System.Windows.Forms.GroupBox
- Me.ListBox1 = New System.Windows.Forms.ListBox
- Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker
- Me.GroupBox2 = New System.Windows.Forms.GroupBox
- Me.dgrkmanage = New System.Windows.Forms.DataGrid
- Me.GroupBox1.SuspendLayout()
- Me.GroupBox2.SuspendLayout()
- CType(Me.dgrkmanage, System.ComponentModel.ISupportInitialize).BeginInit()
- Me.SuspendLayout()
- '
- 'ToolBar1
- '
- Me.ToolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat
- Me.ToolBar1.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.tbrmodify, Me.tbrdelete, Me.tbrfash, Me.tbrprint, Me.tbrexit})
- Me.ToolBar1.DropDownArrows = True
- Me.ToolBar1.Location = New System.Drawing.Point(0, 0)
- Me.ToolBar1.Name = "ToolBar1"
- Me.ToolBar1.ShowToolTips = True
- Me.ToolBar1.Size = New System.Drawing.Size(1028, 44)
- Me.ToolBar1.TabIndex = 0
- '
- 'tbrmodify
- '
- Me.tbrmodify.Text = "修改"
- '
- 'tbrdelete
- '
- Me.tbrdelete.Text = "删除"
- '
- 'tbrfash
- '
- Me.tbrfash.Text = "刷新"
- '
- 'tbrprint
- '
- Me.tbrprint.Text = "打印"
- '
- 'tbrexit
- '
- Me.tbrexit.Text = "退出"
- '
- 'StatusBar1
- '
- Me.StatusBar1.Location = New System.Drawing.Point(0, 602)
- Me.StatusBar1.Name = "StatusBar1"
- Me.StatusBar1.Size = New System.Drawing.Size(1028, 31)
- Me.StatusBar1.TabIndex = 1
- '
- 'GroupBox1
- '
- Me.GroupBox1.Controls.Add(Me.ListBox1)
- Me.GroupBox1.Controls.Add(Me.DateTimePicker1)
- Me.GroupBox1.Location = New System.Drawing.Point(21, 82)
- Me.GroupBox1.Name = "GroupBox1"
- Me.GroupBox1.Size = New System.Drawing.Size(192, 494)
- Me.GroupBox1.TabIndex = 2
- Me.GroupBox1.TabStop = False
- '
- 'ListBox1
- '
- Me.ListBox1.ItemHeight = 15
- Me.ListBox1.Location = New System.Drawing.Point(21, 72)
- Me.ListBox1.Name = "ListBox1"
- Me.ListBox1.Size = New System.Drawing.Size(150, 379)
- Me.ListBox1.TabIndex = 1
- '
- 'DateTimePicker1
- '
- Me.DateTimePicker1.Location = New System.Drawing.Point(21, 31)
- Me.DateTimePicker1.Name = "DateTimePicker1"
- Me.DateTimePicker1.Size = New System.Drawing.Size(150, 25)
- Me.DateTimePicker1.TabIndex = 0
- '
- 'GroupBox2
- '
- Me.GroupBox2.Controls.Add(Me.dgrkmanage)
- Me.GroupBox2.Location = New System.Drawing.Point(224, 82)
- Me.GroupBox2.Name = "GroupBox2"
- Me.GroupBox2.Size = New System.Drawing.Size(811, 494)
- Me.GroupBox2.TabIndex = 3
- Me.GroupBox2.TabStop = False
- '
- 'dgrkmanage
- '
- Me.dgrkmanage.DataMember = ""
- Me.dgrkmanage.HeaderForeColor = System.Drawing.SystemColors.ControlText
- Me.dgrkmanage.Location = New System.Drawing.Point(21, 31)
- Me.dgrkmanage.Name = "dgrkmanage"
- Me.dgrkmanage.Size = New System.Drawing.Size(768, 442)
- Me.dgrkmanage.TabIndex = 0
- '
- 'frmrkmanage
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(8, 18)
- Me.ClientSize = New System.Drawing.Size(1028, 633)
- Me.Controls.Add(Me.GroupBox2)
- Me.Controls.Add(Me.GroupBox1)
- Me.Controls.Add(Me.StatusBar1)
- Me.Controls.Add(Me.ToolBar1)
- Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
- Me.Name = "frmrkmanage"
- Me.Text = "入库票据管理"
- Me.GroupBox1.ResumeLayout(False)
- Me.GroupBox2.ResumeLayout(False)
- CType(Me.dgrkmanage, System.ComponentModel.ISupportInitialize).EndInit()
- Me.ResumeLayout(False)
- End Sub
- #End Region
- Public lsweb As New jxcmanage
- Public dslocals As New DataSet
- Private Sub ListBox1_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedValueChanged
- ListBox1.DisplayMember = "票号"
- ListBox1.ValueMember = "票号"
- dslocals = lsweb.returndataset("select * from wz_rk where 票号 = '" & Me.ListBox1.SelectedValue & "'", "wz_rk")
- dgrkmanage.DataSource = dslocals.Tables(0).DefaultView
- End Sub
- Private Sub DateTimePicker1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DateTimePicker1.TextChanged
- dslocals = lsweb.returndataset("select 票号 from wz_rk where 日期 = '" & Me.DateTimePicker1.Text & "' group by 票号", "wz_rk")
- ListBox1.DataSource = dslocals.Tables("wz_rk")
- ListBox1.DisplayMember = "票号"
- ListBox1.ValueMember = "票号"
- End Sub
- Private Sub Modified()
- If lsweb.updatedataset("select * from wz_rk", "wz_rk", dslocals, DataRowState.Modified) = True Then
- MessageBox.Show("药品信息成功保存!", "提示", MessageBoxButtons.OK)
- Else
- MessageBox.Show("药品信息保存失败!", "提示", MessageBoxButtons.AbortRetryIgnore)
- End If
- End Sub
- Private Sub delete()
- Dim drv As DataRowView = BindingContext(Me.dgrkmanage.DataSource).Current
- If drv("票号") Is System.DBNull.Value Then
- MessageBox.Show("没有要删除的记录!", "提示", MessageBoxButtons.OK)
- Else
- Dim billnumber As String = drv("票号")
- Dim number As Int16 = drv("序号")
- Dim mednumber As String = drv("药品编号")
- If lsweb.deleterk(billnumber, number, mednumber) = True Then
- MessageBox.Show("已经删除记录啦!", "提示", MessageBoxButtons.OK)
- Else
- MessageBox.Show("删除记录失败!", "提示", MessageBoxButtons.OK)
- End If
- End If
- End Sub
- Private Sub print()
- Dim drv As DataRowView = BindingContext(Me.dgrkmanage.DataSource).Current
- If drv("票号") Is System.DBNull.Value Then
- MessageBox.Show("没有要打印的记录!", "提示", MessageBoxButtons.OK)
- Else
- Dim frmviewrkmanager As New frmviewrkmanage
- frmviewrkmanager.strquery = Me.getinfo(drv("票号"))
- frmviewrkmanager.Show()
- End If
- End Sub
- Public Function getinfo(ByVal strqueryid As String) As String
- Dim strOrderId As String
- strOrderId = strqueryid
- Return strOrderId
- End Function
- Private Sub frmrkmanage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- tbrprint.Enabled = False
- tbrmodify.Enabled = False
- tbrdelete.Enabled = False
- End Sub
- Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
- Select Case e.Button.Text
- Case "修改"
- Modified()
- Case "删除"
- delete()
- Case "打印"
- print()
- Case "刷新"
- dslocals = lsweb.returndataset("select * from wz_rk where 票号 = '" & Me.ListBox1.SelectedValue & "'", "wz_rk")
- dgrkmanage.DataSource = dslocals.Tables(0).DefaultView
- Case "退出"
- Me.Close()
- End Select
- End Sub
- Private Sub dgrkmanage_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgrkmanage.CurrentCellChanged
- tbrmodify.Enabled = True
- tbrdelete.Enabled = True
- tbrprint.Enabled = True
- End Sub
- Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
- End Sub
- End Class