frmprice.frm
上传用户:laihaixin
上传日期:2013-01-26
资源大小:1169k
文件大小:12k
源码类别:

医药行业

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
  3. Begin VB.Form frmprice 
  4.    BackColor       =   &H00404040&
  5.    BorderStyle     =   3  'Fixed Dialog
  6.    Caption         =   "调整药品价格"
  7.    ClientHeight    =   2880
  8.    ClientLeft      =   45
  9.    ClientTop       =   330
  10.    ClientWidth     =   4950
  11.    Icon            =   "frmprice.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MDIChild        =   -1  'True
  15.    MinButton       =   0   'False
  16.    Picture         =   "frmprice.frx":030A
  17.    ScaleHeight     =   2880
  18.    ScaleWidth      =   4950
  19.    ShowInTaskbar   =   0   'False
  20.    Begin VB.ComboBox Combo1 
  21.       Height          =   300
  22.       ItemData        =   "frmprice.frx":59F9
  23.       Left            =   1320
  24.       List            =   "frmprice.frx":5A06
  25.       TabIndex        =   19
  26.       Top             =   2445
  27.       Width           =   1200
  28.    End
  29.    Begin VB.TextBox Text8 
  30.       BackColor       =   &H00FFFFFF&
  31.       ForeColor       =   &H000000FF&
  32.       Height          =   830
  33.       Left            =   1200
  34.       MultiLine       =   -1  'True
  35.       TabIndex        =   11
  36.       Top             =   1320
  37.       Width           =   3495
  38.    End
  39.    Begin MSAdodcLib.Adodc Adodc1 
  40.       Height          =   330
  41.       Left            =   3600
  42.       Top             =   885
  43.       Visible         =   0   'False
  44.       Width           =   1200
  45.       _ExtentX        =   2117
  46.       _ExtentY        =   582
  47.       ConnectMode     =   0
  48.       CursorLocation  =   3
  49.       IsolationLevel  =   -1
  50.       ConnectionTimeout=   15
  51.       CommandTimeout  =   30
  52.       CursorType      =   3
  53.       LockType        =   3
  54.       CommandType     =   8
  55.       CursorOptions   =   0
  56.       CacheSize       =   50
  57.       MaxRecords      =   0
  58.       BOFAction       =   0
  59.       EOFAction       =   0
  60.       ConnectStringType=   1
  61.       Appearance      =   1
  62.       BackColor       =   -2147483643
  63.       ForeColor       =   -2147483640
  64.       Orientation     =   0
  65.       Enabled         =   -1
  66.       Connect         =   ""
  67.       OLEDBString     =   ""
  68.       OLEDBFile       =   ""
  69.       DataSourceName  =   ""
  70.       OtherAttributes =   ""
  71.       UserName        =   ""
  72.       Password        =   ""
  73.       RecordSource    =   ""
  74.       Caption         =   "Adodc1"
  75.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  76.          Name            =   "宋体"
  77.          Size            =   9
  78.          Charset         =   134
  79.          Weight          =   400
  80.          Underline       =   0   'False
  81.          Italic          =   0   'False
  82.          Strikethrough   =   0   'False
  83.       EndProperty
  84.       _Version        =   393216
  85.    End
  86.    Begin VB.CommandButton Command3 
  87.       Caption         =   "关闭&(Q)"
  88.       Height          =   300
  89.       Left            =   3735
  90.       TabIndex        =   13
  91.       Top             =   2445
  92.       Width           =   1000
  93.    End
  94.    Begin VB.CommandButton Command1 
  95.       Caption         =   "调价&(C)"
  96.       Height          =   300
  97.       Left            =   2640
  98.       TabIndex        =   12
  99.       Top             =   2445
  100.       Width           =   1000
  101.    End
  102.    Begin VB.TextBox Text5 
  103.       Alignment       =   1  'Right Justify
  104.       BackColor       =   &H00FFFFFF&
  105.       ForeColor       =   &H000000FF&
  106.       Height          =   270
  107.       Left            =   1200
  108.       Locked          =   -1  'True
  109.       MaxLength       =   4
  110.       TabIndex        =   8
  111.       Top             =   960
  112.       Width           =   600
  113.    End
  114.    Begin VB.TextBox Text6 
  115.       Alignment       =   1  'Right Justify
  116.       BackColor       =   &H00FFFFFF&
  117.       ForeColor       =   &H000000FF&
  118.       Height          =   270
  119.       Left            =   2160
  120.       Locked          =   -1  'True
  121.       MaxLength       =   2
  122.       TabIndex        =   9
  123.       Top             =   960
  124.       Width           =   400
  125.    End
  126.    Begin VB.TextBox Text7 
  127.       Alignment       =   1  'Right Justify
  128.       BackColor       =   &H00FFFFFF&
  129.       ForeColor       =   &H000000FF&
  130.       Height          =   270
  131.       Left            =   2880
  132.       Locked          =   -1  'True
  133.       MaxLength       =   2
  134.       TabIndex        =   10
  135.       Top             =   960
  136.       Width           =   400
  137.    End
  138.    Begin VB.TextBox Text4 
  139.       Alignment       =   1  'Right Justify
  140.       BackColor       =   &H00FFFFFF&
  141.       ForeColor       =   &H000000FF&
  142.       Height          =   270
  143.       Left            =   3480
  144.       TabIndex        =   7
  145.       Top             =   600
  146.       Width           =   1200
  147.    End
  148.    Begin VB.TextBox Text3 
  149.       Alignment       =   1  'Right Justify
  150.       BackColor       =   &H00FFFFFF&
  151.       ForeColor       =   &H000000FF&
  152.       Height          =   270
  153.       Left            =   1200
  154.       Locked          =   -1  'True
  155.       TabIndex        =   6
  156.       Top             =   600
  157.       Width           =   1200
  158.    End
  159.    Begin VB.TextBox Text2 
  160.       Alignment       =   1  'Right Justify
  161.       BackColor       =   &H00FFFFFF&
  162.       ForeColor       =   &H000000FF&
  163.       Height          =   270
  164.       Left            =   3480
  165.       Locked          =   -1  'True
  166.       TabIndex        =   5
  167.       Top             =   240
  168.       Width           =   1200
  169.    End
  170.    Begin VB.TextBox Text1 
  171.       Alignment       =   1  'Right Justify
  172.       BackColor       =   &H00FFFFFF&
  173.       ForeColor       =   &H000000FF&
  174.       Height          =   270
  175.       Left            =   1200
  176.       TabIndex        =   4
  177.       Top             =   240
  178.       Width           =   1200
  179.    End
  180.    Begin VB.Label Label10 
  181.       AutoSize        =   -1  'True
  182.       BackStyle       =   0  'Transparent
  183.       Caption         =   "选择库存类型"
  184.       ForeColor       =   &H00000000&
  185.       Height          =   180
  186.       Left            =   150
  187.       TabIndex        =   20
  188.       Top             =   2490
  189.       Width           =   1080
  190.    End
  191.    Begin VB.Label Label9 
  192.       AutoSize        =   -1  'True
  193.       BackColor       =   &H00404040&
  194.       BackStyle       =   0  'Transparent
  195.       Caption         =   "特别备注"
  196.       ForeColor       =   &H00000000&
  197.       Height          =   180
  198.       Left            =   360
  199.       TabIndex        =   18
  200.       Top             =   1560
  201.       Width           =   720
  202.    End
  203.    Begin VB.Line Line1 
  204.       BorderColor     =   &H000000FF&
  205.       X1              =   120
  206.       X2              =   4800
  207.       Y1              =   2280
  208.       Y2              =   2280
  209.    End
  210.    Begin VB.Label Label8 
  211.       AutoSize        =   -1  'True
  212.       BackColor       =   &H00404040&
  213.       BackStyle       =   0  'Transparent
  214.       Caption         =   "调价日期"
  215.       ForeColor       =   &H00000000&
  216.       Height          =   180
  217.       Left            =   360
  218.       TabIndex        =   17
  219.       Top             =   1005
  220.       Width           =   720
  221.    End
  222.    Begin VB.Label Label7 
  223.       AutoSize        =   -1  'True
  224.       BackColor       =   &H00404040&
  225.       BackStyle       =   0  'Transparent
  226.       Caption         =   "年"
  227.       ForeColor       =   &H00000000&
  228.       Height          =   180
  229.       Left            =   1890
  230.       TabIndex        =   16
  231.       Top             =   1005
  232.       Width           =   180
  233.    End
  234.    Begin VB.Label Label5 
  235.       AutoSize        =   -1  'True
  236.       BackColor       =   &H00404040&
  237.       BackStyle       =   0  'Transparent
  238.       Caption         =   "月"
  239.       ForeColor       =   &H00000000&
  240.       Height          =   180
  241.       Left            =   2640
  242.       TabIndex        =   15
  243.       Top             =   1005
  244.       Width           =   180
  245.    End
  246.    Begin VB.Label Label6 
  247.       AutoSize        =   -1  'True
  248.       BackColor       =   &H00404040&
  249.       BackStyle       =   0  'Transparent
  250.       Caption         =   "日"
  251.       ForeColor       =   &H00000000&
  252.       Height          =   180
  253.       Left            =   3345
  254.       TabIndex        =   14
  255.       Top             =   1005
  256.       Width           =   180
  257.    End
  258.    Begin VB.Label Label4 
  259.       AutoSize        =   -1  'True
  260.       BackColor       =   &H00404040&
  261.       BackStyle       =   0  'Transparent
  262.       Caption         =   "调整价格"
  263.       ForeColor       =   &H00000000&
  264.       Height          =   180
  265.       Left            =   2640
  266.       TabIndex        =   3
  267.       Top             =   645
  268.       Width           =   720
  269.    End
  270.    Begin VB.Label Label3 
  271.       AutoSize        =   -1  'True
  272.       BackColor       =   &H00404040&
  273.       BackStyle       =   0  'Transparent
  274.       Caption         =   "原始价格"
  275.       ForeColor       =   &H00000000&
  276.       Height          =   180
  277.       Left            =   360
  278.       TabIndex        =   2
  279.       Top             =   645
  280.       Width           =   720
  281.    End
  282.    Begin VB.Label Label2 
  283.       AutoSize        =   -1  'True
  284.       BackColor       =   &H00404040&
  285.       BackStyle       =   0  'Transparent
  286.       Caption         =   "名    称"
  287.       ForeColor       =   &H00000000&
  288.       Height          =   180
  289.       Left            =   2640
  290.       TabIndex        =   1
  291.       Top             =   285
  292.       Width           =   720
  293.    End
  294.    Begin VB.Label Label1 
  295.       AutoSize        =   -1  'True
  296.       BackColor       =   &H00404040&
  297.       BackStyle       =   0  'Transparent
  298.       Caption         =   "编    号"
  299.       ForeColor       =   &H00000000&
  300.       Height          =   180
  301.       Left            =   360
  302.       TabIndex        =   0
  303.       Top             =   285
  304.       Width           =   720
  305.    End
  306. End
  307. Attribute VB_Name = "frmprice"
  308. Attribute VB_GlobalNameSpace = False
  309. Attribute VB_Creatable = False
  310. Attribute VB_PredeclaredId = True
  311. Attribute VB_Exposed = False
  312. Public dbase As String
  313. Private Sub Combo1_Click()
  314. Select Case Combo1.Text
  315. Case "西药成药库"
  316. dbase = "kcyp"
  317. Text1.Enabled = True
  318. Text1.SetFocus
  319. Case "中草药库"
  320. dbase = "caoyao"
  321. Text1.Enabled = True
  322. Text1.SetFocus
  323. Case "器械材料库"
  324. dbase = "qixie"
  325. Text1.Enabled = True
  326. Text1.SetFocus
  327. End Select
  328. End Sub
  329. Private Sub Command1_Click()
  330. Dim new_price As Currency
  331. On Error GoTo err2
  332. new_price = CCur(Text4.Text)
  333. With Adodc1
  334. If Text8.Text <> "" Then
  335. .RecordSource = "select * from " & dbase & " where 编号='" & Text1.Text & "' and 名称='" & Text2.Text & "'"
  336. .Refresh
  337. .Recordset.Fields("零售价") = new_price
  338. .Recordset.Fields("零售合计") = .Recordset.Fields("数量") * new_price
  339. .Recordset.Fields("差额") = .Recordset.Fields("零售合计") - .Recordset.Fields("进价合计")
  340. .Recordset.Fields("调价日期") = Date
  341. .Recordset.Fields("备注") = Text8.Text
  342. .Recordset.Update
  343. Command1.Enabled = False
  344. Text1.Text = ""
  345. Text2.Text = ""
  346. Text3.Text = ""
  347. Text4.Text = ""
  348. Text8.Text = ""
  349. Else
  350. MsgBox "请在备注中详细填写所有药房中该药品调价前的剩余量。"
  351. End If
  352. End With
  353. Exit Sub
  354. err2:
  355. MsgBox "数据类型不匹配或填写完整!"
  356. End Sub
  357. Private Sub Command3_Click()
  358. Unload Me
  359. End Sub
  360. Private Sub Form_Load()
  361. On Error GoTo err3
  362. frmprice.Top = (frmmain.Height - frmprice.Height) / 2 - 500
  363. frmprice.Left = (frmmain.Width - frmprice.Width) / 2
  364. Adodc1.ConnectionString = frmlogin.conn
  365. Command1.Enabled = False
  366. Text1.Enabled = False
  367. Text5.Text = Year(Date)
  368. Text6.Text = Month(Date)
  369. Text7.Text = Day(Date)
  370. Exit Sub
  371. err3:
  372. MsgBox "数据库连接失败!"
  373. End Sub
  374. Private Sub Text1_Change()
  375. On Error GoTo err1
  376. With Adodc1
  377. .RecordSource = "select * from " & dbase & " where 编号='" & Text1.Text & "'"
  378. .Refresh
  379. If .Recordset.AbsolutePosition <> adPosUnknown Then
  380. Text2.Text = .Recordset.Fields("名称")
  381. Text3.Text = .Recordset.Fields("零售价")
  382. Text4.Text = Text3.Text
  383. Command1.Enabled = True
  384. Else
  385. Command1.Enabled = False
  386. Text2.Text = ""
  387. Text3.Text = ""
  388. Text4.Text = ""
  389. Text1.SetFocus
  390. End If
  391. End With
  392. Exit Sub
  393. err1:
  394. MsgBox "输入了非法字符或数据填写不完整!"
  395. End Sub
  396. Private Sub Text4_LostFocus()
  397. If Not IsNumeric(Text4.Text) Or Text4.Text Like "%.%" Then
  398. MsgBox "调整价格只能填写数值!"
  399. Text4.SetFocus
  400. End If
  401. End Sub
  402. Private Sub Form_Unload(Cancel As Integer)
  403. frmmain.StatusBar1.Panels(2) = "目前没有窗口被激活"
  404. End Sub
  405. Private Sub Form_Activate()
  406. frmmain.StatusBar1.Panels(2) = "活动窗口:" & frmprice.Caption
  407. End Sub
  408. Private Sub Text4_GotFocus()
  409. Text4.SelStart = 0
  410. Text4.SelLength = Len(Text4.Text)
  411. End Sub
  412. Private Sub Text1_GotFocus()
  413. Text1.SelStart = 0
  414. Text1.SelLength = Len(Text1.Text)
  415. End Sub