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

医药行业

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
  3. Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
  4. Begin VB.Form frmclear 
  5.    BackColor       =   &H00404040&
  6.    BorderStyle     =   3  'Fixed Dialog
  7.    Caption         =   "清理过期报废库存品"
  8.    ClientHeight    =   4080
  9.    ClientLeft      =   45
  10.    ClientTop       =   330
  11.    ClientWidth     =   9975
  12.    Icon            =   "frmclear.frx":0000
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MDIChild        =   -1  'True
  16.    MinButton       =   0   'False
  17.    Picture         =   "frmclear.frx":030A
  18.    ScaleHeight     =   4080
  19.    ScaleWidth      =   9975
  20.    ShowInTaskbar   =   0   'False
  21.    Begin VB.ComboBox Combo2 
  22.       Height          =   300
  23.       ItemData        =   "frmclear.frx":59F9
  24.       Left            =   1440
  25.       List            =   "frmclear.frx":5A06
  26.       TabIndex        =   7
  27.       Top             =   3645
  28.       Width           =   1335
  29.    End
  30.    Begin VB.CommandButton Command4 
  31.       Caption         =   "全部清理&(A)"
  32.       Height          =   350
  33.       Left            =   3900
  34.       TabIndex        =   4
  35.       Top             =   3615
  36.       Width           =   1500
  37.    End
  38.    Begin VB.CommandButton Command3 
  39.       Caption         =   "关闭&(C)"
  40.       Height          =   350
  41.       Left            =   8520
  42.       TabIndex        =   3
  43.       Top             =   3615
  44.       Width           =   1200
  45.    End
  46.    Begin VB.CommandButton Command2 
  47.       Caption         =   "更新&(U)"
  48.       Height          =   350
  49.       Left            =   7080
  50.       TabIndex        =   2
  51.       Top             =   3615
  52.       Width           =   1200
  53.    End
  54.    Begin VB.CommandButton Command1 
  55.       Caption         =   "删除&(D)"
  56.       Height          =   350
  57.       Left            =   5640
  58.       TabIndex        =   1
  59.       Top             =   3615
  60.       Width           =   1200
  61.    End
  62.    Begin MSDataGridLib.DataGrid DataGrid1 
  63.       Height          =   3135
  64.       Left            =   120
  65.       TabIndex        =   0
  66.       Top             =   360
  67.       Width           =   9710
  68.       _ExtentX        =   17119
  69.       _ExtentY        =   5530
  70.       _Version        =   393216
  71.       AllowUpdate     =   0   'False
  72.       BackColor       =   16777215
  73.       DefColWidth     =   53
  74.       ForeColor       =   16711680
  75.       HeadLines       =   1.5
  76.       RowHeight       =   15
  77.       BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  78.          Name            =   "宋体"
  79.          Size            =   9
  80.          Charset         =   134
  81.          Weight          =   400
  82.          Underline       =   0   'False
  83.          Italic          =   0   'False
  84.          Strikethrough   =   0   'False
  85.       EndProperty
  86.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  87.          Name            =   "宋体"
  88.          Size            =   9
  89.          Charset         =   134
  90.          Weight          =   400
  91.          Underline       =   0   'False
  92.          Italic          =   0   'False
  93.          Strikethrough   =   0   'False
  94.       EndProperty
  95.       ColumnCount     =   2
  96.       BeginProperty Column00 
  97.          DataField       =   ""
  98.          Caption         =   ""
  99.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  100.             Type            =   0
  101.             Format          =   ""
  102.             HaveTrueFalseNull=   0
  103.             FirstDayOfWeek  =   0
  104.             FirstWeekOfYear =   0
  105.             LCID            =   2052
  106.             SubFormatType   =   0
  107.          EndProperty
  108.       EndProperty
  109.       BeginProperty Column01 
  110.          DataField       =   ""
  111.          Caption         =   ""
  112.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  113.             Type            =   0
  114.             Format          =   ""
  115.             HaveTrueFalseNull=   0
  116.             FirstDayOfWeek  =   0
  117.             FirstWeekOfYear =   0
  118.             LCID            =   2052
  119.             SubFormatType   =   0
  120.          EndProperty
  121.       EndProperty
  122.       SplitCount      =   1
  123.       BeginProperty Split0 
  124.          BeginProperty Column00 
  125.          EndProperty
  126.          BeginProperty Column01 
  127.          EndProperty
  128.       EndProperty
  129.    End
  130.    Begin MSAdodcLib.Adodc Adodc1 
  131.       Height          =   330
  132.       Left            =   5280
  133.       Top             =   0
  134.       Visible         =   0   'False
  135.       Width           =   1335
  136.       _ExtentX        =   2355
  137.       _ExtentY        =   582
  138.       ConnectMode     =   0
  139.       CursorLocation  =   3
  140.       IsolationLevel  =   -1
  141.       ConnectionTimeout=   15
  142.       CommandTimeout  =   30
  143.       CursorType      =   3
  144.       LockType        =   3
  145.       CommandType     =   8
  146.       CursorOptions   =   0
  147.       CacheSize       =   50
  148.       MaxRecords      =   0
  149.       BOFAction       =   0
  150.       EOFAction       =   0
  151.       ConnectStringType=   1
  152.       Appearance      =   1
  153.       BackColor       =   -2147483643
  154.       ForeColor       =   -2147483640
  155.       Orientation     =   0
  156.       Enabled         =   -1
  157.       Connect         =   ""
  158.       OLEDBString     =   ""
  159.       OLEDBFile       =   ""
  160.       DataSourceName  =   ""
  161.       OtherAttributes =   ""
  162.       UserName        =   ""
  163.       Password        =   ""
  164.       RecordSource    =   ""
  165.       Caption         =   "Adodc1"
  166.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  167.          Name            =   "宋体"
  168.          Size            =   9
  169.          Charset         =   134
  170.          Weight          =   400
  171.          Underline       =   0   'False
  172.          Italic          =   0   'False
  173.          Strikethrough   =   0   'False
  174.       EndProperty
  175.       _Version        =   393216
  176.    End
  177.    Begin VB.Label Label2 
  178.       AutoSize        =   -1  'True
  179.       BackStyle       =   0  'Transparent
  180.       Caption         =   "选择数据库"
  181.       ForeColor       =   &H00000000&
  182.       Height          =   180
  183.       Left            =   480
  184.       TabIndex        =   6
  185.       Top             =   3705
  186.       Width           =   900
  187.    End
  188.    Begin VB.Label Label1 
  189.       AutoSize        =   -1  'True
  190.       BackStyle       =   0  'Transparent
  191.       ForeColor       =   &H000000FF&
  192.       Height          =   180
  193.       Left            =   360
  194.       TabIndex        =   5
  195.       Top             =   90
  196.       Width           =   90
  197.    End
  198. End
  199. Attribute VB_Name = "frmclear"
  200. Attribute VB_GlobalNameSpace = False
  201. Attribute VB_Creatable = False
  202. Attribute VB_PredeclaredId = True
  203. Attribute VB_Exposed = False
  204. Public Sub Guolu()
  205. On Error GoTo err0
  206. With Adodc1
  207. .RecordSource = "select * from " & frmmain.datas & " where 失效标记=false"
  208. .Refresh
  209. For i = 0 To .Recordset.RecordCount
  210. If Not .Recordset.EOF Then
  211.     If .Recordset.Fields("失效期") <= Date Then
  212.         .Recordset.Fields("失效标记") = True
  213.         .Recordset.Update
  214.     Else
  215.         .Recordset.Fields("失效标记") = False
  216.         .Recordset.Update
  217.     End If
  218. .Recordset.MoveNext
  219. End If
  220. Next
  221. .RecordSource = "select * from " & frmmain.datas & " where 失效标记=true"
  222. .Refresh
  223. Label1.Caption = Combo2.Text & "中过期或报废共:" & .Recordset.RecordCount & " 种"
  224. DataGrid1.AllowUpdate = False
  225. Set DataGrid1.DataSource = Adodc1
  226. DataGrid1.Columns(0).Visible = False
  227. DataGrid1.Columns(17).Visible = False
  228. DataGrid1.Columns("进价").NumberFormat = "0.00"
  229. DataGrid1.Columns("进价合计").NumberFormat = "0.00"
  230. DataGrid1.Columns("零售价").NumberFormat = "0.00"
  231. DataGrid1.Columns("零售合计").NumberFormat = "0.00"
  232. DataGrid1.Columns("差额").NumberFormat = "0.00"
  233. DataGrid1.Columns(1).Width = 1000
  234. DataGrid1.Columns(2).Width = 1200
  235. DataGrid1.Columns(3).Width = 1200
  236. DataGrid1.Columns(4).Width = 600
  237. DataGrid1.Columns(5).Width = 600
  238. DataGrid1.Columns(6).Width = 600
  239. End With
  240. Exit Sub
  241. err0:
  242. MsgBox "数据库已空或连接失败!"
  243. End Sub
  244. Private Sub Combo2_Click()
  245. On Error GoTo wrong
  246. Select Case Combo2.Text
  247. Case "西药中成药库"
  248.     frmmain.datas = "kcyp"
  249.     frmclear.Caption = "清理过期或报废西药和中成药数据"
  250.     Call Guolu
  251. Case "中草药库"
  252.     frmmain.datas = "caoyao"
  253.     frmclear.Caption = "清理失效或报废中草药数据"
  254.     Call Guolu
  255. Case "器械材料库"
  256.     frmmain.datas = "qixie"
  257.     frmclear.Caption = "清理报废医疗器械和材料数据"
  258.     Call Guolu
  259. Case Else
  260.     frmclear.Caption = "清理过期报废库存品"
  261. End Select
  262. Exit Sub
  263. wrong:
  264. MsgBox "请检查网络连接是否正常!"
  265. End Sub
  266. Private Sub Command1_Click()
  267. On Error GoTo err1
  268. Dim respond As String
  269. With Adodc1
  270. respond = MsgBox("当前过期报废药品记录将被清理,继续吗?", 4, "特别警告")
  271. If respond = vbYes Then
  272.     .RecordSource = "select * from " & frmmain.datas & " where 失效标记=true"
  273.     .Refresh
  274.     .Recordset.Fields("数量") = 0
  275.     .Recordset.Fields("进价") = 0
  276.     .Recordset.Fields("进价合计") = 0
  277.     .Recordset.Fields("零售价") = 0
  278.     .Recordset.Fields("零售合计") = 0
  279.     .Recordset.Fields("差额") = 0
  280.     .Recordset.MoveNext
  281.     .Recordset.UpdateBatch
  282.     If .Recordset.EOF Then .Recordset.MoveNext
  283. End If
  284. End With
  285. Exit Sub
  286. err1:
  287. MsgBox "数据库已空或选择了无效的数据!"
  288. End Sub
  289. Private Sub Command2_Click()
  290. On Error GoTo err3
  291. Adodc1.Recordset.UpdateBatch
  292. Exit Sub
  293. err3:
  294. MsgBox "数据库中没有记录或数据库无效!"
  295. End Sub
  296. Private Sub Command3_Click()
  297. Unload Me
  298. End Sub
  299. Private Sub Command4_Click()
  300. Dim respond As String
  301. On Error GoTo err4
  302. With Adodc1
  303. respond = MsgBox("本操作将清理所有过期报废药品记录,继续吗?", 4, "特别警告")
  304. If respond = vbYes Then
  305. .RecordSource = "select * from " & frmmain.datas & " where 失效标记=true"
  306. .Refresh
  307. .Recordset.MoveFirst
  308. For i = 0 To .Recordset.RecordCount - 1
  309. .Recordset.Fields("数量") = 0
  310. .Recordset.Fields("进价") = 0
  311. .Recordset.Fields("进价合计") = 0
  312. .Recordset.Fields("零售价") = 0
  313. .Recordset.Fields("零售合计") = 0
  314. .Recordset.Fields("差额") = 0
  315. .Recordset.MoveNext
  316. .Recordset.UpdateBatch
  317. Next
  318. End If
  319. End With
  320. Exit Sub
  321. err4:
  322. MsgBox "数据库已空或选择了无效的数据!"
  323. End Sub
  324. Private Sub Form_Load()
  325. On Error GoTo err2
  326. frmclear.Top = (frmmain.Height - frmclear.Height) / 2 - 500
  327. frmclear.Left = (frmmain.Width - frmclear.Width) / 2
  328. Adodc1.ConnectionString = frmlogin.conn
  329. Exit Sub
  330. err2:
  331. MsgBox "远程数据库连接失败,请检查网络连接!"
  332. End Sub
  333. Private Sub Form_Unload(Cancel As Integer)
  334. frmmain.StatusBar1.Panels(2) = "目前没有窗口被激活"
  335. End Sub
  336. Private Sub Form_Activate()
  337. frmmain.StatusBar1.Panels(2) = "活动窗口:" & frmclear.Caption
  338. End Sub