frmckmanage.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:11k
- Public Class frmckmanage
- 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 StatusBar1 As System.Windows.Forms.StatusBar
- Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
- 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 dgckmanage As System.Windows.Forms.DataGrid
- Friend WithEvents tbrck As System.Windows.Forms.ToolBar
- Friend WithEvents DateTimePicker1 As System.Windows.Forms.DateTimePicker
- Friend WithEvents tbrfash As System.Windows.Forms.ToolBarButton
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- Me.tbrck = 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.GroupBox1 = New System.Windows.Forms.GroupBox
- Me.ListBox1 = New System.Windows.Forms.ListBox
- Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker
- Me.StatusBar1 = New System.Windows.Forms.StatusBar
- Me.GroupBox2 = New System.Windows.Forms.GroupBox
- Me.dgckmanage = New System.Windows.Forms.DataGrid
- Me.GroupBox1.SuspendLayout()
- Me.GroupBox2.SuspendLayout()
- CType(Me.dgckmanage, System.ComponentModel.ISupportInitialize).BeginInit()
- Me.SuspendLayout()
- '
- 'tbrck
- '
- Me.tbrck.Appearance = System.Windows.Forms.ToolBarAppearance.Flat
- Me.tbrck.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.tbrmodify, Me.tbrDelete, Me.tbrfash, Me.tbrPrint, Me.tbrExit})
- Me.tbrck.DropDownArrows = True
- Me.tbrck.Location = New System.Drawing.Point(0, 0)
- Me.tbrck.Name = "tbrck"
- Me.tbrck.ShowToolTips = True
- Me.tbrck.Size = New System.Drawing.Size(1109, 41)
- Me.tbrck.TabIndex = 0
- '
- 'tbrmodify
- '
- Me.tbrmodify.Name = "tbrmodify"
- Me.tbrmodify.Text = "修改"
- '
- 'tbrDelete
- '
- Me.tbrDelete.Name = "tbrDelete"
- Me.tbrDelete.Text = "删除"
- '
- 'tbrfash
- '
- Me.tbrfash.Name = "tbrfash"
- Me.tbrfash.Text = "刷新"
- '
- 'tbrPrint
- '
- Me.tbrPrint.Name = "tbrPrint"
- Me.tbrPrint.Text = "打印"
- '
- 'tbrExit
- '
- Me.tbrExit.Name = "tbrExit"
- Me.tbrExit.Text = "退出"
- '
- 'GroupBox1
- '
- Me.GroupBox1.Controls.Add(Me.ListBox1)
- Me.GroupBox1.Controls.Add(Me.DateTimePicker1)
- Me.GroupBox1.Location = New System.Drawing.Point(8, 56)
- Me.GroupBox1.Name = "GroupBox1"
- Me.GroupBox1.Size = New System.Drawing.Size(144, 392)
- Me.GroupBox1.TabIndex = 1
- Me.GroupBox1.TabStop = False
- '
- 'ListBox1
- '
- Me.ListBox1.ItemHeight = 12
- Me.ListBox1.Location = New System.Drawing.Point(16, 56)
- Me.ListBox1.Name = "ListBox1"
- Me.ListBox1.Size = New System.Drawing.Size(112, 292)
- Me.ListBox1.TabIndex = 1
- '
- 'DateTimePicker1
- '
- Me.DateTimePicker1.Location = New System.Drawing.Point(16, 24)
- Me.DateTimePicker1.Name = "DateTimePicker1"
- Me.DateTimePicker1.Size = New System.Drawing.Size(112, 21)
- Me.DateTimePicker1.TabIndex = 4
- '
- 'StatusBar1
- '
- Me.StatusBar1.Location = New System.Drawing.Point(0, 598)
- Me.StatusBar1.Name = "StatusBar1"
- Me.StatusBar1.Size = New System.Drawing.Size(1109, 25)
- Me.StatusBar1.TabIndex = 2
- '
- 'GroupBox2
- '
- Me.GroupBox2.Controls.Add(Me.dgckmanage)
- Me.GroupBox2.Location = New System.Drawing.Point(160, 56)
- Me.GroupBox2.Name = "GroupBox2"
- Me.GroupBox2.Size = New System.Drawing.Size(664, 392)
- Me.GroupBox2.TabIndex = 3
- Me.GroupBox2.TabStop = False
- '
- 'dgckmanage
- '
- Me.dgckmanage.DataMember = ""
- Me.dgckmanage.HeaderForeColor = System.Drawing.SystemColors.ControlText
- Me.dgckmanage.Location = New System.Drawing.Point(16, 24)
- Me.dgckmanage.Name = "dgckmanage"
- Me.dgckmanage.Size = New System.Drawing.Size(632, 352)
- Me.dgckmanage.TabIndex = 0
- '
- 'frmckmanage
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
- Me.ClientSize = New System.Drawing.Size(1109, 623)
- Me.ControlBox = False
- Me.Controls.Add(Me.GroupBox2)
- Me.Controls.Add(Me.StatusBar1)
- Me.Controls.Add(Me.GroupBox1)
- Me.Controls.Add(Me.tbrck)
- Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
- Me.Name = "frmckmanage"
- Me.Text = "销售票据管理"
- Me.GroupBox1.ResumeLayout(False)
- Me.GroupBox2.ResumeLayout(False)
- CType(Me.dgckmanage, System.ComponentModel.ISupportInitialize).EndInit()
- Me.ResumeLayout(False)
- Me.PerformLayout()
- 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_ck where 票号 = '" & Me.ListBox1.SelectedValue & "'", "wz_ck")
- dgckmanage.DataSource = dslocals.Tables(0).DefaultView
- End Sub
- Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tbrck.ButtonClick
- Select Case e.Button.Text
- Case "修改"
- Modified()
- tbnEnable("tbrModify.Enabled = False", tbrck)
- Case "删除"
- delete()
- tbnEnable("tbrDelete.Enabled = False", tbrck)
- Case "打印"
- print()
- Case "刷新"
- dslocals = lsweb.returndataset("select * from wz_ck where 票号 = '" & Me.ListBox1.SelectedValue & "'", "wz_ck")
- dgckmanage.DataSource = dslocals.Tables(0).DefaultView
- Case "退出"
- Me.Close()
- End Select
- End Sub
- Private Sub Modified()
- If lsweb.updatedataset("select * from wz_ck", "wz_ck", 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.dgckmanage.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.deleteck(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.dgckmanage.DataSource).Current
- If drv("票号") Is System.DBNull.Value Then
- MessageBox.Show("没有要打印的记录!", "提示", MessageBoxButtons.OK)
- Else
- Dim frmviewckmanager As New frmviewckmanage
- frmviewckmanager.strquery = lsweb.getinfoes(drv("票号"))
- frmviewckmanager.Show()
- End If
- End Sub
- Public Sub tbnEnable(ByVal strboolean As String, ByVal tbr As ToolBar)
- If strboolean = "tbrModify.Enabled = True" Then
- tbrDelete.Enabled = False
- tbrPrint.Enabled = False
- tbrExit.Enabled = True
- ElseIf strboolean = "tbrModify.Enabled = False" Then
- tbrmodify.Enabled = False
- tbrDelete.Enabled = False
- tbrPrint.Enabled = True
- tbrExit.Enabled = True
- ElseIf strboolean = "tbrDelete.Enabled = True" Then
- tbrmodify.Enabled = False
- tbrPrint.Enabled = False
- tbrExit.Enabled = True
- ElseIf strboolean = "tbrDelete.Enabled = False" Then
- tbrDelete.Enabled = False
- tbrmodify.Enabled = False
- tbrPrint.Enabled = False
- tbrExit.Enabled = True
- 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 frmckmanage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- dslocals = lsweb.returndataset("select * from wz_ck", "wz_ck")
- dslocals.Clear()
- dgckmanage.DataSource = dslocals.Tables(0).DefaultView
- tbrmodify.Enabled = False
- tbrDelete.Enabled = False
- tbrPrint.Enabled = False
- End Sub
-
-
-
- Private Sub DateTimePicker1_TextChanged1(ByVal sender As Object, ByVal e As System.EventArgs) Handles DateTimePicker1.TextChanged
- dslocals = lsweb.returndataset("select 票号 from wz_ck where 日期 = '" & Me.DateTimePicker1.Text.Trim & "' group by 票号", "wz_ck")
- ListBox1.DataSource = dslocals.Tables("wz_ck")
- ListBox1.DisplayMember = "票号"
- ListBox1.ValueMember = "票号"
- End Sub
-
- Private Sub dgckmanage_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgckmanage.CurrentCellChanged
- tbrmodify.Enabled = True
- tbrDelete.Enabled = True
- tbrPrint.Enabled = True
- End Sub
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
- End Sub
- End Class