frmrkmanage.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:10k
源码类别:

医药行业

开发平台:

Visual Basic

  1. Public Class frmrkmanage
  2.     Inherits System.Windows.Forms.Form
  3. #Region " Windows 窗体设计器生成的代码 "
  4.     Public Sub New()
  5.         MyBase.New()
  6.         '该调用是 Windows 窗体设计器所必需的。
  7.         InitializeComponent()
  8.         '在 InitializeComponent() 调用之后添加任何初始化
  9.     End Sub
  10.     '窗体重写 dispose 以清理组件列表。
  11.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  12.         If disposing Then
  13.             If Not (components Is Nothing) Then
  14.                 components.Dispose()
  15.             End If
  16.         End If
  17.         MyBase.Dispose(disposing)
  18.     End Sub
  19.     'Windows 窗体设计器所必需的
  20.     Private components As System.ComponentModel.IContainer
  21.     '注意: 以下过程是 Windows 窗体设计器所必需的
  22.     '可以使用 Windows 窗体设计器修改此过程。
  23.     '不要使用代码编辑器修改它。
  24.     Friend WithEvents ToolBar1 As System.Windows.Forms.ToolBar
  25.     Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar
  26.     Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
  27.     Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
  28.     Friend WithEvents DateTimePicker1 As System.Windows.Forms.DateTimePicker
  29.     Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
  30.     Friend WithEvents tbrmodify As System.Windows.Forms.ToolBarButton
  31.     Friend WithEvents tbrdelete As System.Windows.Forms.ToolBarButton
  32.     Friend WithEvents tbrprint As System.Windows.Forms.ToolBarButton
  33.     Friend WithEvents tbrexit As System.Windows.Forms.ToolBarButton
  34.     Friend WithEvents dgrkmanage As System.Windows.Forms.DataGrid
  35.     Friend WithEvents tbrfash As System.Windows.Forms.ToolBarButton
  36.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  37.         Me.ToolBar1 = New System.Windows.Forms.ToolBar
  38.         Me.tbrmodify = New System.Windows.Forms.ToolBarButton
  39.         Me.tbrdelete = New System.Windows.Forms.ToolBarButton
  40.         Me.tbrfash = New System.Windows.Forms.ToolBarButton
  41.         Me.tbrprint = New System.Windows.Forms.ToolBarButton
  42.         Me.tbrexit = New System.Windows.Forms.ToolBarButton
  43.         Me.StatusBar1 = New System.Windows.Forms.StatusBar
  44.         Me.GroupBox1 = New System.Windows.Forms.GroupBox
  45.         Me.ListBox1 = New System.Windows.Forms.ListBox
  46.         Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker
  47.         Me.GroupBox2 = New System.Windows.Forms.GroupBox
  48.         Me.dgrkmanage = New System.Windows.Forms.DataGrid
  49.         Me.GroupBox1.SuspendLayout()
  50.         Me.GroupBox2.SuspendLayout()
  51.         CType(Me.dgrkmanage, System.ComponentModel.ISupportInitialize).BeginInit()
  52.         Me.SuspendLayout()
  53.         '
  54.         'ToolBar1
  55.         '
  56.         Me.ToolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat
  57.         Me.ToolBar1.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.tbrmodify, Me.tbrdelete, Me.tbrfash, Me.tbrprint, Me.tbrexit})
  58.         Me.ToolBar1.DropDownArrows = True
  59.         Me.ToolBar1.Location = New System.Drawing.Point(0, 0)
  60.         Me.ToolBar1.Name = "ToolBar1"
  61.         Me.ToolBar1.ShowToolTips = True
  62.         Me.ToolBar1.Size = New System.Drawing.Size(1028, 44)
  63.         Me.ToolBar1.TabIndex = 0
  64.         '
  65.         'tbrmodify
  66.         '
  67.         Me.tbrmodify.Text = "修改"
  68.         '
  69.         'tbrdelete
  70.         '
  71.         Me.tbrdelete.Text = "删除"
  72.         '
  73.         'tbrfash
  74.         '
  75.         Me.tbrfash.Text = "刷新"
  76.         '
  77.         'tbrprint
  78.         '
  79.         Me.tbrprint.Text = "打印"
  80.         '
  81.         'tbrexit
  82.         '
  83.         Me.tbrexit.Text = "退出"
  84.         '
  85.         'StatusBar1
  86.         '
  87.         Me.StatusBar1.Location = New System.Drawing.Point(0, 602)
  88.         Me.StatusBar1.Name = "StatusBar1"
  89.         Me.StatusBar1.Size = New System.Drawing.Size(1028, 31)
  90.         Me.StatusBar1.TabIndex = 1
  91.         '
  92.         'GroupBox1
  93.         '
  94.         Me.GroupBox1.Controls.Add(Me.ListBox1)
  95.         Me.GroupBox1.Controls.Add(Me.DateTimePicker1)
  96.         Me.GroupBox1.Location = New System.Drawing.Point(21, 82)
  97.         Me.GroupBox1.Name = "GroupBox1"
  98.         Me.GroupBox1.Size = New System.Drawing.Size(192, 494)
  99.         Me.GroupBox1.TabIndex = 2
  100.         Me.GroupBox1.TabStop = False
  101.         '
  102.         'ListBox1
  103.         '
  104.         Me.ListBox1.ItemHeight = 15
  105.         Me.ListBox1.Location = New System.Drawing.Point(21, 72)
  106.         Me.ListBox1.Name = "ListBox1"
  107.         Me.ListBox1.Size = New System.Drawing.Size(150, 379)
  108.         Me.ListBox1.TabIndex = 1
  109.         '
  110.         'DateTimePicker1
  111.         '
  112.         Me.DateTimePicker1.Location = New System.Drawing.Point(21, 31)
  113.         Me.DateTimePicker1.Name = "DateTimePicker1"
  114.         Me.DateTimePicker1.Size = New System.Drawing.Size(150, 25)
  115.         Me.DateTimePicker1.TabIndex = 0
  116.         '
  117.         'GroupBox2
  118.         '
  119.         Me.GroupBox2.Controls.Add(Me.dgrkmanage)
  120.         Me.GroupBox2.Location = New System.Drawing.Point(224, 82)
  121.         Me.GroupBox2.Name = "GroupBox2"
  122.         Me.GroupBox2.Size = New System.Drawing.Size(811, 494)
  123.         Me.GroupBox2.TabIndex = 3
  124.         Me.GroupBox2.TabStop = False
  125.         '
  126.         'dgrkmanage
  127.         '
  128.         Me.dgrkmanage.DataMember = ""
  129.         Me.dgrkmanage.HeaderForeColor = System.Drawing.SystemColors.ControlText
  130.         Me.dgrkmanage.Location = New System.Drawing.Point(21, 31)
  131.         Me.dgrkmanage.Name = "dgrkmanage"
  132.         Me.dgrkmanage.Size = New System.Drawing.Size(768, 442)
  133.         Me.dgrkmanage.TabIndex = 0
  134.         '
  135.         'frmrkmanage
  136.         '
  137.         Me.AutoScaleBaseSize = New System.Drawing.Size(8, 18)
  138.         Me.ClientSize = New System.Drawing.Size(1028, 633)
  139.         Me.Controls.Add(Me.GroupBox2)
  140.         Me.Controls.Add(Me.GroupBox1)
  141.         Me.Controls.Add(Me.StatusBar1)
  142.         Me.Controls.Add(Me.ToolBar1)
  143.         Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
  144.         Me.Name = "frmrkmanage"
  145.         Me.Text = "入库票据管理"
  146.         Me.GroupBox1.ResumeLayout(False)
  147.         Me.GroupBox2.ResumeLayout(False)
  148.         CType(Me.dgrkmanage, System.ComponentModel.ISupportInitialize).EndInit()
  149.         Me.ResumeLayout(False)
  150.     End Sub
  151. #End Region
  152.     Public lsweb As New jxcmanage
  153.     Public dslocals As New DataSet
  154.     Private Sub ListBox1_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedValueChanged
  155.         ListBox1.DisplayMember = "票号"
  156.         ListBox1.ValueMember = "票号"
  157.         dslocals = lsweb.returndataset("select * from wz_rk where 票号 = '" & Me.ListBox1.SelectedValue & "'", "wz_rk")
  158.         dgrkmanage.DataSource = dslocals.Tables(0).DefaultView
  159.     End Sub
  160.     Private Sub DateTimePicker1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DateTimePicker1.TextChanged
  161.         dslocals = lsweb.returndataset("select 票号 from wz_rk where 日期 = '" & Me.DateTimePicker1.Text & "' group by 票号", "wz_rk")
  162.         ListBox1.DataSource = dslocals.Tables("wz_rk")
  163.         ListBox1.DisplayMember = "票号"
  164.         ListBox1.ValueMember = "票号"
  165.     End Sub
  166.     Private Sub Modified()
  167.         If lsweb.updatedataset("select * from wz_rk", "wz_rk", dslocals, DataRowState.Modified) = True Then
  168.             MessageBox.Show("药品信息成功保存!", "提示", MessageBoxButtons.OK)
  169.         Else
  170.             MessageBox.Show("药品信息保存失败!", "提示", MessageBoxButtons.AbortRetryIgnore)
  171.         End If
  172.     End Sub
  173.     Private Sub delete()
  174.         Dim drv As DataRowView = BindingContext(Me.dgrkmanage.DataSource).Current
  175.         If drv("票号") Is System.DBNull.Value Then
  176.             MessageBox.Show("没有要删除的记录!", "提示", MessageBoxButtons.OK)
  177.         Else
  178.             Dim billnumber As String = drv("票号")
  179.             Dim number As Int16 = drv("序号")
  180.             Dim mednumber As String = drv("药品编号")
  181.             If lsweb.deleterk(billnumber, number, mednumber) = True Then
  182.                 MessageBox.Show("已经删除记录啦!", "提示", MessageBoxButtons.OK)
  183.             Else
  184.                 MessageBox.Show("删除记录失败!", "提示", MessageBoxButtons.OK)
  185.             End If
  186.         End If
  187.     End Sub
  188.     Private Sub print()
  189.         Dim drv As DataRowView = BindingContext(Me.dgrkmanage.DataSource).Current
  190.         If drv("票号") Is System.DBNull.Value Then
  191.             MessageBox.Show("没有要打印的记录!", "提示", MessageBoxButtons.OK)
  192.         Else
  193.             Dim frmviewrkmanager As New frmviewrkmanage
  194.             frmviewrkmanager.strquery = Me.getinfo(drv("票号"))
  195.             frmviewrkmanager.Show()
  196.         End If
  197.     End Sub
  198.     Public Function getinfo(ByVal strqueryid As String) As String
  199.         Dim strOrderId As String
  200.         strOrderId = strqueryid
  201.         Return strOrderId
  202.     End Function
  203.     Private Sub frmrkmanage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  204.         tbrprint.Enabled = False
  205.         tbrmodify.Enabled = False
  206.         tbrdelete.Enabled = False
  207.     End Sub
  208.     Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
  209.         Select Case e.Button.Text
  210.             Case "修改"
  211.                 Modified()
  212.             Case "删除"
  213.                 delete()
  214.             Case "打印"
  215.                 print()
  216.             Case "刷新"
  217.                 dslocals = lsweb.returndataset("select * from wz_rk where 票号 = '" & Me.ListBox1.SelectedValue & "'", "wz_rk")
  218.                 dgrkmanage.DataSource = dslocals.Tables(0).DefaultView
  219.             Case "退出"
  220.                 Me.Close()
  221.         End Select
  222.     End Sub
  223.     Private Sub dgrkmanage_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgrkmanage.CurrentCellChanged
  224.         tbrmodify.Enabled = True
  225.         tbrdelete.Enabled = True
  226.         tbrprint.Enabled = True
  227.     End Sub
  228.     Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
  229.     End Sub
  230. End Class