frmprice.frm
资源名称:yf.rar [点击查看]
上传用户:laihaixin
上传日期:2013-01-26
资源大小:1169k
文件大小:12k
源码类别:
医药行业
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
- Begin VB.Form frmprice
- BackColor = &H00404040&
- BorderStyle = 3 'Fixed Dialog
- Caption = "调整药品价格"
- ClientHeight = 2880
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 4950
- Icon = "frmprice.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MDIChild = -1 'True
- MinButton = 0 'False
- Picture = "frmprice.frx":030A
- ScaleHeight = 2880
- ScaleWidth = 4950
- ShowInTaskbar = 0 'False
- Begin VB.ComboBox Combo1
- Height = 300
- ItemData = "frmprice.frx":59F9
- Left = 1320
- List = "frmprice.frx":5A06
- TabIndex = 19
- Top = 2445
- Width = 1200
- End
- Begin VB.TextBox Text8
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 830
- Left = 1200
- MultiLine = -1 'True
- TabIndex = 11
- Top = 1320
- Width = 3495
- End
- Begin MSAdodcLib.Adodc Adodc1
- Height = 330
- Left = 3600
- Top = 885
- Visible = 0 'False
- Width = 1200
- _ExtentX = 2117
- _ExtentY = 582
- ConnectMode = 0
- CursorLocation = 3
- IsolationLevel = -1
- ConnectionTimeout= 15
- CommandTimeout = 30
- CursorType = 3
- LockType = 3
- CommandType = 8
- CursorOptions = 0
- CacheSize = 50
- MaxRecords = 0
- BOFAction = 0
- EOFAction = 0
- ConnectStringType= 1
- Appearance = 1
- BackColor = -2147483643
- ForeColor = -2147483640
- Orientation = 0
- Enabled = -1
- Connect = ""
- OLEDBString = ""
- OLEDBFile = ""
- DataSourceName = ""
- OtherAttributes = ""
- UserName = ""
- Password = ""
- RecordSource = ""
- Caption = "Adodc1"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- _Version = 393216
- End
- Begin VB.CommandButton Command3
- Caption = "关闭&(Q)"
- Height = 300
- Left = 3735
- TabIndex = 13
- Top = 2445
- Width = 1000
- End
- Begin VB.CommandButton Command1
- Caption = "调价&(C)"
- Height = 300
- Left = 2640
- TabIndex = 12
- Top = 2445
- Width = 1000
- End
- Begin VB.TextBox Text5
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 1200
- Locked = -1 'True
- MaxLength = 4
- TabIndex = 8
- Top = 960
- Width = 600
- End
- Begin VB.TextBox Text6
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 2160
- Locked = -1 'True
- MaxLength = 2
- TabIndex = 9
- Top = 960
- Width = 400
- End
- Begin VB.TextBox Text7
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 2880
- Locked = -1 'True
- MaxLength = 2
- TabIndex = 10
- Top = 960
- Width = 400
- End
- Begin VB.TextBox Text4
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 3480
- TabIndex = 7
- Top = 600
- Width = 1200
- End
- Begin VB.TextBox Text3
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 1200
- Locked = -1 'True
- TabIndex = 6
- Top = 600
- Width = 1200
- End
- Begin VB.TextBox Text2
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 3480
- Locked = -1 'True
- TabIndex = 5
- Top = 240
- Width = 1200
- End
- Begin VB.TextBox Text1
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 1200
- TabIndex = 4
- Top = 240
- Width = 1200
- End
- Begin VB.Label Label10
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "选择库存类型"
- ForeColor = &H00000000&
- Height = 180
- Left = 150
- TabIndex = 20
- Top = 2490
- Width = 1080
- End
- Begin VB.Label Label9
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "特别备注"
- ForeColor = &H00000000&
- Height = 180
- Left = 360
- TabIndex = 18
- Top = 1560
- Width = 720
- End
- Begin VB.Line Line1
- BorderColor = &H000000FF&
- X1 = 120
- X2 = 4800
- Y1 = 2280
- Y2 = 2280
- End
- Begin VB.Label Label8
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "调价日期"
- ForeColor = &H00000000&
- Height = 180
- Left = 360
- TabIndex = 17
- Top = 1005
- Width = 720
- End
- Begin VB.Label Label7
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "年"
- ForeColor = &H00000000&
- Height = 180
- Left = 1890
- TabIndex = 16
- Top = 1005
- Width = 180
- End
- Begin VB.Label Label5
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "月"
- ForeColor = &H00000000&
- Height = 180
- Left = 2640
- TabIndex = 15
- Top = 1005
- Width = 180
- End
- Begin VB.Label Label6
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "日"
- ForeColor = &H00000000&
- Height = 180
- Left = 3345
- TabIndex = 14
- Top = 1005
- Width = 180
- End
- Begin VB.Label Label4
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "调整价格"
- ForeColor = &H00000000&
- Height = 180
- Left = 2640
- TabIndex = 3
- Top = 645
- Width = 720
- End
- Begin VB.Label Label3
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "原始价格"
- ForeColor = &H00000000&
- Height = 180
- Left = 360
- TabIndex = 2
- Top = 645
- Width = 720
- End
- Begin VB.Label Label2
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "名 称"
- ForeColor = &H00000000&
- Height = 180
- Left = 2640
- TabIndex = 1
- Top = 285
- Width = 720
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "编 号"
- ForeColor = &H00000000&
- Height = 180
- Left = 360
- TabIndex = 0
- Top = 285
- Width = 720
- End
- End
- Attribute VB_Name = "frmprice"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Public dbase As String
- Private Sub Combo1_Click()
- Select Case Combo1.Text
- Case "西药成药库"
- dbase = "kcyp"
- Text1.Enabled = True
- Text1.SetFocus
- Case "中草药库"
- dbase = "caoyao"
- Text1.Enabled = True
- Text1.SetFocus
- Case "器械材料库"
- dbase = "qixie"
- Text1.Enabled = True
- Text1.SetFocus
- End Select
- End Sub
- Private Sub Command1_Click()
- Dim new_price As Currency
- On Error GoTo err2
- new_price = CCur(Text4.Text)
- With Adodc1
- If Text8.Text <> "" Then
- .RecordSource = "select * from " & dbase & " where 编号='" & Text1.Text & "' and 名称='" & Text2.Text & "'"
- .Refresh
- .Recordset.Fields("零售价") = new_price
- .Recordset.Fields("零售合计") = .Recordset.Fields("数量") * new_price
- .Recordset.Fields("差额") = .Recordset.Fields("零售合计") - .Recordset.Fields("进价合计")
- .Recordset.Fields("调价日期") = Date
- .Recordset.Fields("备注") = Text8.Text
- .Recordset.Update
- Command1.Enabled = False
- Text1.Text = ""
- Text2.Text = ""
- Text3.Text = ""
- Text4.Text = ""
- Text8.Text = ""
- Else
- MsgBox "请在备注中详细填写所有药房中该药品调价前的剩余量。"
- End If
- End With
- Exit Sub
- err2:
- MsgBox "数据类型不匹配或填写完整!"
- End Sub
- Private Sub Command3_Click()
- Unload Me
- End Sub
- Private Sub Form_Load()
- On Error GoTo err3
- frmprice.Top = (frmmain.Height - frmprice.Height) / 2 - 500
- frmprice.Left = (frmmain.Width - frmprice.Width) / 2
- Adodc1.ConnectionString = frmlogin.conn
- Command1.Enabled = False
- Text1.Enabled = False
- Text5.Text = Year(Date)
- Text6.Text = Month(Date)
- Text7.Text = Day(Date)
- Exit Sub
- err3:
- MsgBox "数据库连接失败!"
- End Sub
- Private Sub Text1_Change()
- On Error GoTo err1
- With Adodc1
- .RecordSource = "select * from " & dbase & " where 编号='" & Text1.Text & "'"
- .Refresh
- If .Recordset.AbsolutePosition <> adPosUnknown Then
- Text2.Text = .Recordset.Fields("名称")
- Text3.Text = .Recordset.Fields("零售价")
- Text4.Text = Text3.Text
- Command1.Enabled = True
- Else
- Command1.Enabled = False
- Text2.Text = ""
- Text3.Text = ""
- Text4.Text = ""
- Text1.SetFocus
- End If
- End With
- Exit Sub
- err1:
- MsgBox "输入了非法字符或数据填写不完整!"
- End Sub
- Private Sub Text4_LostFocus()
- If Not IsNumeric(Text4.Text) Or Text4.Text Like "%.%" Then
- MsgBox "调整价格只能填写数值!"
- Text4.SetFocus
- End If
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- frmmain.StatusBar1.Panels(2) = "目前没有窗口被激活"
- End Sub
- Private Sub Form_Activate()
- frmmain.StatusBar1.Panels(2) = "活动窗口:" & frmprice.Caption
- End Sub
- Private Sub Text4_GotFocus()
- Text4.SelStart = 0
- Text4.SelLength = Len(Text4.Text)
- End Sub
- Private Sub Text1_GotFocus()
- Text1.SelStart = 0
- Text1.SelLength = Len(Text1.Text)
- End Sub