frmMain.frm
Upload User: djzm888
Upload Date: 2013-02-15
Package Size: 867k
Code Size: 82k
Category:

Other Databases

Development Platform:

Visual Basic

  1. VERSION 5.00
  2. Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
  3. Object = "{FE0065C0-1B7B-11CF-9D53-00AA003C9CB6}#1.1#0"; "COMCT232.OCX"
  4. Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
  5. Begin VB.Form frmMain 
  6.    BorderStyle     =   3  'Fixed Dialog
  7.    ClientHeight    =   8190
  8.    ClientLeft      =   150
  9.    ClientTop       =   435
  10.    ClientWidth     =   11880
  11.    BeginProperty Font 
  12.       Name            =   "宋体"
  13.       Size            =   10.5
  14.       Charset         =   134
  15.       Weight          =   400
  16.       Underline       =   0   'False
  17.       Italic          =   0   'False
  18.       Strikethrough   =   0   'False
  19.    EndProperty
  20.    Icon            =   "frmMain.frx":0000
  21.    LockControls    =   -1  'True
  22.    MaxButton       =   0   'False
  23.    MinButton       =   0   'False
  24.    Moveable        =   0   'False
  25.    ScaleHeight     =   8190
  26.    ScaleWidth      =   11880
  27.    ShowInTaskbar   =   0   'False
  28.    StartUpPosition =   3  '窗口缺省
  29.    Begin MSMask.MaskEdBox medTime 
  30.       Height          =   345
  31.       Left            =   3795
  32.       TabIndex        =   70
  33.       Top             =   5145
  34.       Visible         =   0   'False
  35.       Width           =   765
  36.       _ExtentX        =   1349
  37.       _ExtentY        =   609
  38.       _Version        =   393216
  39.       BackColor       =   -2147483624
  40.       MaxLength       =   5
  41.       Mask            =   "##:##"
  42.       PromptChar      =   "_"
  43.    End
  44.    Begin MSMask.MaskEdBox medDate 
  45.       Height          =   360
  46.       Left            =   3555
  47.       TabIndex        =   69
  48.       Top             =   4605
  49.       Visible         =   0   'False
  50.       Width           =   1215
  51.       _ExtentX        =   2143
  52.       _ExtentY        =   635
  53.       _Version        =   393216
  54.       BackColor       =   -2147483624
  55.       MaxLength       =   10
  56.       Mask            =   "####-##-##"
  57.       PromptChar      =   "_"
  58.    End
  59.    Begin VB.TextBox txtEdit 
  60.       BackColor       =   &H80000018&
  61.       Height          =   360
  62.       Left            =   3375
  63.       MaxLength       =   4
  64.       TabIndex        =   1
  65.       Top             =   4050
  66.       Visible         =   0   'False
  67.       Width           =   1275
  68.    End
  69.    Begin MSFlexGridLib.MSFlexGrid msfGrid 
  70.       Height          =   4680
  71.       Left            =   180
  72.       TabIndex        =   0
  73.       Top             =   3195
  74.       Width           =   11535
  75.       _ExtentX        =   20346
  76.       _ExtentY        =   8255
  77.       _Version        =   393216
  78.       Rows            =   20
  79.       FixedCols       =   0
  80.       BackColor       =   -2147483624
  81.       BackColorFixed  =   12632256
  82.       ForeColorFixed  =   12582912
  83.       BackColorBkg    =   -2147483624
  84.       FormatString    =   "<sdfsdddsdsdsdsd"
  85.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  86.          Name            =   "宋体"
  87.          Size            =   10.5
  88.          Charset         =   134
  89.          Weight          =   400
  90.          Underline       =   0   'False
  91.          Italic          =   0   'False
  92.          Strikethrough   =   0   'False
  93.       EndProperty
  94.    End
  95.    Begin VB.Frame fraList 
  96.       Height          =   2235
  97.       Left            =   210
  98.       TabIndex        =   43
  99.       Top             =   795
  100.       Visible         =   0   'False
  101.       Width           =   11520
  102.       Begin VB.ListBox lstInValidCard 
  103.          Height          =   1530
  104.          Left            =   5925
  105.          TabIndex        =   45
  106.          Top             =   495
  107.          Width           =   5310
  108.       End
  109.       Begin VB.ListBox lstNotRegister 
  110.          Height          =   1530
  111.          Left            =   255
  112.          TabIndex        =   44
  113.          Top             =   495
  114.          Width           =   5310
  115.       End
  116.       Begin VB.Label Label3 
  117.          AutoSize        =   -1  'True
  118.          Caption         =   "记录总数:"
  119.          Height          =   210
  120.          Index           =   1
  121.          Left            =   9120
  122.          TabIndex        =   51
  123.          Top             =   225
  124.          Width           =   945
  125.       End
  126.       Begin VB.Label lblInvalidCard 
  127.          AutoSize        =   -1  'True
  128.          Caption         =   "0"
  129.          Height          =   210
  130.          Left            =   10260
  131.          TabIndex        =   50
  132.          Top             =   240
  133.          Width           =   105
  134.       End
  135.       Begin VB.Label Label3 
  136.          AutoSize        =   -1  'True
  137.          Caption         =   "记录总数:"
  138.          Height          =   210
  139.          Index           =   0
  140.          Left            =   3255
  141.          TabIndex        =   49
  142.          Top             =   225
  143.          Width           =   945
  144.       End
  145.       Begin VB.Label lblNotRegister 
  146.          AutoSize        =   -1  'True
  147.          Caption         =   "0"
  148.          Height          =   210
  149.          Left            =   4395
  150.          TabIndex        =   48
  151.          Top             =   225
  152.          Width           =   105
  153.       End
  154.       Begin VB.Label Label2 
  155.          AutoSize        =   -1  'True
  156.          Caption         =   "采集到无效流通卡记录列表"
  157.          Height          =   210
  158.          Index           =   1
  159.          Left            =   5925
  160.          TabIndex        =   47
  161.          Top             =   225
  162.          Width           =   2520
  163.       End
  164.       Begin VB.Label Label2 
  165.          AutoSize        =   -1  'True
  166.          Caption         =   "采集到卡未登记记录列表"
  167.          Height          =   210
  168.          Index           =   0
  169.          Left            =   240
  170.          TabIndex        =   46
  171.          Top             =   225
  172.          Width           =   2310
  173.       End
  174.    End
  175.    Begin VB.Frame fraEdit 
  176.       Height          =   2235
  177.       Left            =   210
  178.       TabIndex        =   2
  179.       Top             =   795
  180.       Visible         =   0   'False
  181.       Width           =   11520
  182.       Begin VB.TextBox txtKQ 
  183.          Height          =   330
  184.          Index           =   13
  185.          Left            =   9375
  186.          MaxLength       =   12
  187.          TabIndex        =   30
  188.          Top             =   1235
  189.          Width           =   1830
  190.       End
  191.       Begin VB.PictureBox picHour 
  192.          BackColor       =   &H00FFFFFF&
  193.          Height          =   345
  194.          Index           =   1
  195.          Left            =   9360
  196.          ScaleHeight     =   285
  197.          ScaleWidth      =   555
  198.          TabIndex        =   41
  199.          Top             =   255
  200.          Width           =   615
  201.          Begin VB.TextBox txtKQ 
  202.             Alignment       =   2  'Center
  203.             BorderStyle     =   0  'None
  204.             Height          =   315
  205.             Index           =   7
  206.             Left            =   30
  207.             TabIndex        =   20
  208.             Text            =   "1"
  209.             Top             =   45
  210.             Width           =   240
  211.          End
  212.          Begin ComCtl2.UpDown VScrollHour 
  213.             Height          =   315
  214.             Index           =   0
  215.             Left            =   285
  216.             TabIndex        =   21
  217.             TabStop         =   0   'False
  218.             Top             =   -15
  219.             Width           =   270
  220.             _ExtentX        =   476
  221.             _ExtentY        =   556
  222.             _Version        =   327681
  223.             BuddyControl    =   "txtKQ(7)"
  224.             BuddyDispid     =   196622
  225.             BuddyIndex      =   7
  226.             OrigLeft        =   300
  227.             OrigTop         =   -15
  228.             OrigRight       =   570
  229.             OrigBottom      =   300
  230.             Max             =   23
  231.             SyncBuddy       =   -1  'True
  232.             Wrap            =   -1  'True
  233.             BuddyProperty   =   65547
  234.             Enabled         =   -1  'True
  235.          End
  236.       End
  237.       Begin VB.PictureBox picHour 
  238.          BackColor       =   &H00FFFFFF&
  239.          Height          =   345
  240.          Index           =   0
  241.          Left            =   9360
  242.          ScaleHeight     =   285
  243.          ScaleWidth      =   555
  244.          TabIndex        =   40
  245.          Top             =   738
  246.          Width           =   615
  247.          Begin ComCtl2.UpDown VScrollMinite 
  248.             Height          =   315
  249.             Index           =   0
  250.             Left            =   285
  251.             TabIndex        =   26
  252.             TabStop         =   0   'False
  253.             Top             =   -15
  254.             Width           =   270
  255.             _ExtentX        =   476
  256.             _ExtentY        =   556
  257.             _Version        =   327681
  258.             BuddyControl    =   "txtKQ(10)"
  259.             BuddyDispid     =   196622
  260.             BuddyIndex      =   10
  261.             OrigLeft        =   285
  262.             OrigTop         =   -15
  263.             OrigRight       =   555
  264.             OrigBottom      =   300
  265.             Max             =   23
  266.             SyncBuddy       =   -1  'True
  267.             Wrap            =   -1  'True
  268.             BuddyProperty   =   65547
  269.             Enabled         =   -1  'True
  270.          End
  271.          Begin VB.TextBox txtKQ 
  272.             Alignment       =   2  'Center
  273.             BorderStyle     =   0  'None
  274.             Height          =   315
  275.             Index           =   10
  276.             Left            =   15
  277.             TabIndex        =   25
  278.             Text            =   "1"
  279.             Top             =   30
  280.             Width           =   255
  281.          End
  282.       End
  283.       Begin VB.PictureBox picMinite 
  284.          BackColor       =   &H00FFFFFF&
  285.          Height          =   345
  286.          Index           =   1
  287.          Left            =   10380
  288.          ScaleHeight     =   285
  289.          ScaleWidth      =   555
  290.          TabIndex        =   37
  291.          Top             =   248
  292.          Width           =   615
  293.          Begin ComCtl2.UpDown VScrollHour 
  294.             Height          =   300
  295.             Index           =   1
  296.             Left            =   285
  297.             TabIndex        =   23
  298.             TabStop         =   0   'False
  299.             Top             =   0
  300.             Width           =   270
  301.             _ExtentX        =   476
  302.             _ExtentY        =   529
  303.             _Version        =   327681
  304.             BuddyControl    =   "txtKQ(8)"
  305.             BuddyDispid     =   196622
  306.             BuddyIndex      =   8
  307.             OrigLeft        =   285
  308.             OrigRight       =   555
  309.             OrigBottom      =   300
  310.             Max             =   59
  311.             SyncBuddy       =   -1  'True
  312.             Wrap            =   -1  'True
  313.             BuddyProperty   =   65547
  314.             Enabled         =   -1  'True
  315.          End
  316.          Begin VB.TextBox txtKQ 
  317.             Alignment       =   2  'Center
  318.             BorderStyle     =   0  'None
  319.             Height          =   315
  320.             Index           =   8
  321.             Left            =   30
  322.             TabIndex        =   22
  323.             Text            =   "1"
  324.             Top             =   45
  325.             Width           =   255
  326.          End
  327.       End
  328.       Begin VB.PictureBox picMinite 
  329.          BackColor       =   &H00FFFFFF&
  330.          DrawStyle       =   2  'Dot
  331.          DrawWidth       =   17015
  332.          Height          =   345
  333.          Index           =   0
  334.          Left            =   10380
  335.          ScaleHeight     =   285
  336.          ScaleWidth      =   555
  337.          TabIndex        =   34
  338.          Top             =   738
  339.          Width           =   615
  340.          Begin ComCtl2.UpDown VScrollMinite 
  341.             Height          =   315
  342.             Index           =   1
  343.             Left            =   285
  344.             TabIndex        =   28
  345.             TabStop         =   0   'False
  346.             Top             =   -15
  347.             Width           =   270
  348.             _ExtentX        =   476
  349.             _ExtentY        =   556
  350.             _Version        =   327681
  351.             BuddyControl    =   "txtKQ(11)"
  352.             BuddyDispid     =   196622
  353.             BuddyIndex      =   11
  354.             OrigLeft        =   285
  355.             OrigTop         =   -15
  356.             OrigRight       =   555
  357.             OrigBottom      =   300
  358.             Max             =   59
  359.             SyncBuddy       =   -1  'True
  360.             Wrap            =   -1  'True
  361.             BuddyProperty   =   65547
  362.             Enabled         =   -1  'True
  363.          End
  364.          Begin VB.TextBox txtKQ 
  365.             Alignment       =   2  'Center
  366.             BorderStyle     =   0  'None
  367.             Height          =   315
  368.             Index           =   11
  369.             Left            =   45
  370.             TabIndex        =   27
  371.             Text            =   "1"
  372.             Top             =   45
  373.             Width           =   225
  374.          End
  375.       End
  376.       Begin VB.TextBox txtKQ 
  377.          Height          =   330
  378.          Index           =   9
  379.          Left            =   6585
  380.          Locked          =   -1  'True
  381.          TabIndex        =   24
  382.          Top             =   745
  383.          Width           =   1410
  384.       End
  385.       Begin VB.ComboBox cboKQ 
  386.          Enabled         =   0   'False
  387.          Height          =   330
  388.          Left            =   6585
  389.          Style           =   2  'Dropdown List
  390.          TabIndex        =   29
  391.          Top             =   1235
  392.          Width           =   1425
  393.       End
  394.       Begin VB.TextBox txtKQ 
  395.          Height          =   330
  396.          Index           =   12
  397.          Left            =   1230
  398.          MaxLength       =   50
  399.          TabIndex        =   31
  400.          Top             =   1725
  401.          Width           =   9990
  402.       End
  403.       Begin VB.TextBox txtKQ 
  404.          Height          =   330
  405.          Index           =   6
  406.          Left            =   6585
  407.          Locked          =   -1  'True
  408.          TabIndex        =   19
  409.          Top             =   255
  410.          Width           =   1410
  411.       End
  412.       Begin VB.TextBox txtKQ 
  413.          Enabled         =   0   'False
  414.          Height          =   330
  415.          Index           =   5
  416.          Left            =   3915
  417.          Locked          =   -1  'True
  418.          TabIndex        =   18
  419.          Top             =   1235
  420.          Width           =   1410
  421.       End
  422.       Begin VB.TextBox txtKQ 
  423.          Enabled         =   0   'False
  424.          Height          =   330
  425.          Index           =   4
  426.          Left            =   1230
  427.          Locked          =   -1  'True
  428.          TabIndex        =   17
  429.          Top             =   1235
  430.          Width           =   1410
  431.       End
  432.       Begin VB.TextBox txtKQ 
  433.          Enabled         =   0   'False
  434.          Height          =   330
  435.          Index           =   3
  436.          Left            =   3915
  437.          Locked          =   -1  'True
  438.          TabIndex        =   16
  439.          Top             =   745
  440.          Width           =   1410
  441.       End
  442.       Begin VB.TextBox txtKQ 
  443.          Enabled         =   0   'False
  444.          Height          =   330
  445.          Index           =   2
  446.          Left            =   1230
  447.          Locked          =   -1  'True
  448.          TabIndex        =   15
  449.          Top             =   745
  450.          Width           =   1410
  451.       End
  452.       Begin VB.TextBox txtKQ 
  453.          Enabled         =   0   'False
  454.          Height          =   330
  455.          Index           =   1
  456.          Left            =   3915
  457.          Locked          =   -1  'True
  458.          TabIndex        =   14
  459.          Top             =   255
  460.          Width           =   1410
  461.       End
  462.       Begin VB.TextBox txtKQ 
  463.          Height          =   330
  464.          Index           =   0
  465.          Left            =   1230
  466.          TabIndex        =   13
  467.          Top             =   255
  468.          Width           =   1410
  469.       End
  470.       Begin VB.Label Label1 
  471.          AutoSize        =   -1  'True
  472.          Caption         =   "批 准 人:"
  473.          Height          =   210
  474.          Index           =   10
  475.          Left            =   8325
  476.          TabIndex        =   42
  477.          Top             =   1290
  478.          Width           =   945
  479.       End
  480.       Begin VB.Label Label1 
  481.          AutoSize        =   -1  'True
  482.          Caption         =   "分"
  483.          Height          =   210
  484.          Index           =   15
  485.          Left            =   11055
  486.          TabIndex        =   39
  487.          Top             =   315
  488.          Width           =   210
  489.       End
  490.       Begin VB.Label Label1 
  491.          AutoSize        =   -1  'True
  492.          Caption         =   "时"
  493.          Height          =   210
  494.          Index           =   14
  495.          Left            =   10035
  496.          TabIndex        =   38
  497.          Top             =   315
  498.          Width           =   210
  499.       End
  500.       Begin VB.Label Label1 
  501.          AutoSize        =   -1  'True
  502.          Caption         =   "分"
  503.          Height          =   210
  504.          Index           =   13
  505.          Left            =   11055
  506.          TabIndex        =   36
  507.          Top             =   802
  508.          Width           =   210
  509.       End
  510.       Begin VB.Label Label1 
  511.          AutoSize        =   -1  'True
  512.          Caption         =   "时"
  513.          Height          =   210
  514.          Index           =   12
  515.          Left            =   10035
  516.          TabIndex        =   35
  517.          Top             =   795
  518.          Width           =   210
  519.       End
  520.       Begin VB.Label Label1 
  521.          AutoSize        =   -1  'True
  522.          Caption         =   "截止日期:"
  523.          Height          =   210
  524.          Index           =   11
  525.          Left            =   5610
  526.          TabIndex        =   33
  527.          Top             =   805
  528.          Width           =   945
  529.       End
  530.       Begin VB.Label Label1 
  531.          AutoSize        =   -1  'True
  532.          Caption         =   "截止时间:"
  533.          Height          =   210
  534.          Index           =   8
  535.          Left            =   8325
  536.          TabIndex        =   32
  537.          Top             =   805
  538.          Width           =   945
  539.       End
  540.       Begin VB.Label lblReason 
  541.          AutoSize        =   -1  'True
  542.          Caption         =   "请假事由:"
  543.          Height          =   210
  544.          Left            =   240
  545.          TabIndex        =   12
  546.          Top             =   1785
  547.          Width           =   945
  548.       End
  549.       Begin VB.Label Label1 
  550.          AutoSize        =   -1  'True
  551.          Caption         =   "请假类别:"
  552.          Height          =   210
  553.          Index           =   9
  554.          Left            =   5610
  555.          TabIndex        =   11
  556.          Top             =   1295
  557.          Width           =   945
  558.       End
  559.       Begin VB.Label Label1 
  560.          AutoSize        =   -1  'True
  561.          Caption         =   "起始时间:"
  562.          Height          =   210
  563.          Index           =   7
  564.          Left            =   8325
  565.          TabIndex        =   10
  566.          Top             =   315
  567.          Width           =   945
  568.       End
  569.       Begin VB.Label Label1 
  570.          AutoSize        =   -1  'True
  571.          Caption         =   "起始日期:"
  572.          Height          =   210
  573.          Index           =   6
  574.          Left            =   5610
  575.          TabIndex        =   9
  576.          Top             =   315
  577.          Width           =   945
  578.       End
  579.       Begin VB.Label Label1 
  580.          AutoSize        =   -1  'True
  581.          Caption         =   "部    门:"
  582.          Height          =   210
  583.          Index           =   5
  584.          Left            =   2940
  585.          TabIndex        =   8
  586.          Top             =   1295
  587.          Width           =   945
  588.       End
  589.       Begin VB.Label Label1 
  590.          AutoSize        =   -1  'True
  591.          Caption         =   "职    务:"
  592.          Height          =   210
  593.          Index           =   4
  594.          Left            =   240
  595.          TabIndex        =   7
  596.          Top             =   1295
  597.          Width           =   945
  598.       End
  599.       Begin VB.Label Label1 
  600.          AutoSize        =   -1  'True
  601.          Caption         =   "年    龄:"
  602.          Height          =   210
  603.          Index           =   3
  604.          Left            =   2940
  605.          TabIndex        =   6
  606.          Top             =   805
  607.          Width           =   945
  608.       End
  609.       Begin VB.Label Label1 
  610.          AutoSize        =   -1  'True
  611.          Caption         =   "性    别:"
  612.          Height          =   210
  613.          Index           =   2
  614.          Left            =   240
  615.          TabIndex        =   5
  616.          Top             =   805
  617.          Width           =   945
  618.       End
  619.       Begin VB.Label Label1 
  620.          AutoSize        =   -1  'True
  621.          Caption         =   "姓    名:"
  622.          Height          =   210
  623.          Index           =   1
  624.          Left            =   2940
  625.          TabIndex        =   4
  626.          Top             =   315
  627.          Width           =   945
  628.       End
  629.       Begin VB.Label Label1 
  630.          AutoSize        =   -1  'True
  631.          Caption         =   "工    号:"
  632.          Height          =   210
  633.          Index           =   0
  634.          Left            =   240
  635.          TabIndex        =   3
  636.          Top             =   315
  637.          Width           =   945
  638.       End
  639.    End
  640.    Begin VB.PictureBox picMain 
  641.       Height          =   660
  642.       Left            =   210
  643.       ScaleHeight     =   600
  644.       ScaleWidth      =   11430
  645.       TabIndex        =   60
  646.       Top             =   75
  647.       Width           =   11490
  648.       Begin VB.CommandButton cmdKq 
  649.          BackColor       =   &H00C0C0C0&
  650.          Height          =   465
  651.          Index           =   6
  652.          Left            =   7848
  653.          Picture         =   "frmMain.frx":000C
  654.          Style           =   1  'Graphical
  655.          TabIndex        =   68
  656.          Top             =   75
  657.          UseMaskColor    =   -1  'True
  658.          Width           =   1245
  659.       End
  660.       Begin VB.CommandButton cmdKq 
  661.          BackColor       =   &H00C0C0C0&
  662.          Height          =   465
  663.          Index           =   5
  664.          Left            =   9705
  665.          Picture         =   "frmMain.frx":1CFA
  666.          Style           =   1  'Graphical
  667.          TabIndex        =   67
  668.          Top             =   75
  669.          UseMaskColor    =   -1  'True
  670.          Width           =   1245
  671.       End
  672.       Begin VB.CommandButton cmdKq 
  673.          BackColor       =   &H00FFFFFF&
  674.          Caption         =   "查找(&Q)"
  675.          Height          =   465
  676.          Index           =   4
  677.          Left            =   7395
  678.          TabIndex        =   66
  679.          Top             =   120
  680.          UseMaskColor    =   -1  'True
  681.          Visible         =   0   'False
  682.          Width           =   1365
  683.       End
  684.       Begin VB.CommandButton cmdKq 
  685.          BackColor       =   &H00C0C0C0&
  686.          Height          =   465
  687.          Index           =   3
  688.          Left            =   5991
  689.          Picture         =   "frmMain.frx":3B6B
  690.          Style           =   1  'Graphical
  691.          TabIndex        =   65
  692.          Top             =   75
  693.          UseMaskColor    =   -1  'True
  694.          Width           =   1245
  695.       End
  696.       Begin VB.CommandButton cmdKq 
  697.          BackColor       =   &H00FFFFFF&
  698.          Caption         =   "采集(&C)"
  699.          Height          =   465
  700.          Index           =   7
  701.          Left            =   420
  702.          TabIndex        =   64
  703.          Top             =   75
  704.          UseMaskColor    =   -1  'True
  705.          Width           =   1245
  706.       End
  707.       Begin VB.CommandButton cmdKq 
  708.          BackColor       =   &H00C0C0C0&
  709.          Height          =   465
  710.          Index           =   0
  711.          Left            =   2277
  712.          Picture         =   "frmMain.frx":590A
  713.          Style           =   1  'Graphical
  714.          TabIndex        =   63
  715.          Top             =   75
  716.          UseMaskColor    =   -1  'True
  717.          Width           =   1245
  718.       End
  719.       Begin VB.CommandButton cmdKq 
  720.          BackColor       =   &H00C0C0C0&
  721.          Height          =   465
  722.          Index           =   1
  723.          Left            =   4134
  724.          Picture         =   "frmMain.frx":76A9
  725.          Style           =   1  'Graphical
  726.          TabIndex        =   62
  727.          Top             =   75
  728.          UseMaskColor    =   -1  'True
  729.          Width           =   1245
  730.       End
  731.       Begin VB.CommandButton cmdKq 
  732.          BackColor       =   &H00FFFFFF&
  733.          Caption         =   "修改(&M)"
  734.          Height          =   465
  735.          Index           =   2
  736.          Left            =   4935
  737.          TabIndex        =   61
  738.          Top             =   120
  739.          UseMaskColor    =   -1  'True
  740.          Visible         =   0   'False
  741.          Width           =   1365
  742.       End
  743.    End
  744.    Begin VB.PictureBox picEdit 
  745.       Height          =   660
  746.       Left            =   210
  747.       ScaleHeight     =   600
  748.       ScaleWidth      =   11430
  749.       TabIndex        =   52
  750.       Top             =   75
  751.       Width           =   11490
  752.       Begin VB.CommandButton cmdEdit 
  753.          Height          =   465
  754.          Index           =   6
  755.          Left            =   7905
  756.          Picture         =   "frmMain.frx":94A9
  757.          Style           =   1  'Graphical
  758.          TabIndex        =   59
  759.          Top             =   75
  760.          Width           =   1245
  761.       End
  762.       Begin VB.CommandButton cmdEdit 
  763.          Height          =   465
  764.          Index           =   5
  765.          Left            =   9780
  766.          Picture         =   "frmMain.frx":B197
  767.          Style           =   1  'Graphical
  768.          TabIndex        =   58
  769.          Top             =   75
  770.          Width           =   1245
  771.       End
  772.       Begin VB.CommandButton cmdEdit 
  773.          Height          =   465
  774.          Index           =   3
  775.          Left            =   6045
  776.          Picture         =   "frmMain.frx":D008
  777.          Style           =   1  'Graphical
  778.          TabIndex        =   56
  779.          Top             =   75
  780.          Width           =   1245
  781.       End
  782.       Begin VB.CommandButton cmdEdit 
  783.          Height          =   465
  784.          Index           =   2
  785.          Left            =   4170
  786.          Picture         =   "frmMain.frx":EDA7
  787.          Style           =   1  'Graphical
  788.          TabIndex        =   55
  789.          Top             =   75
  790.          Width           =   1245
  791.       End
  792.       Begin VB.CommandButton cmdEdit 
  793.          Height          =   465
  794.          Index           =   1
  795.          Left            =   2310
  796.          Picture         =   "frmMain.frx":10B8A
  797.          Style           =   1  'Graphical
  798.          TabIndex        =   54
  799.          Top             =   75
  800.          Width           =   1245
  801.       End
  802.       Begin VB.CommandButton cmdEdit 
  803.          Height          =   465
  804.          Index           =   0
  805.          Left            =   450
  806.          Picture         =   "frmMain.frx":1298A
  807.          Style           =   1  'Graphical
  808.          TabIndex        =   53
  809.          Top             =   75
  810.          Width           =   1245
  811.       End
  812.       Begin VB.CommandButton cmdEdit 
  813.          Caption         =   "查询(&S)"
  814.          Height          =   465
  815.          Index           =   4
  816.          Left            =   6135
  817.          TabIndex        =   57
  818.          Top             =   120
  819.          Visible         =   0   'False
  820.          Width           =   1365
  821.       End
  822.    End
  823.    Begin VB.Menu mnuEdit 
  824.       Caption         =   "编辑(&E)"
  825.       Visible         =   0   'False
  826.       Begin VB.Menu mnuEditModify 
  827.          Caption         =   "修改(&M)"
  828.       End
  829.       Begin VB.Menu mnuEditDelete 
  830.          Caption         =   "删除(&D)"
  831.       End
  832.    End
  833.    Begin VB.Menu mnuList 
  834.       Caption         =   "dd"
  835.       Visible         =   0   'False
  836.       Begin VB.Menu mnuListRegister 
  837.          Caption         =   "登记此卡"
  838.       End
  839.       Begin VB.Menu mnuListAppend 
  840.          Caption         =   "添加到考勤中"
  841.       End
  842.    End
  843. End
  844. Attribute VB_Name = "frmMain"
  845. Attribute VB_GlobalNameSpace = False
  846. Attribute VB_Creatable = False
  847. Attribute VB_PredeclaredId = True
  848. Attribute VB_Exposed = False
  849. Option Explicit
  850. Dim mblnIsModify As Boolean
  851. Dim mblnIsAdd As Boolean
  852. Dim mblnIsNeedSave As Boolean
  853. Dim mblnCollectModify As Boolean
  854. Dim mOldKqDate As String
  855. Dim mOldKqTime As String
  856. Dim mPosName As String
  857. Const mDATEMASK = "####-##-##"
  858. Const mTIMEMASK = "##:##"
  859. Public mMenuIndex As Integer 'frmMdi调用
  860. Dim mStatus As Integer 'differ leave,absent
  861. Dim mFormatString  As String
  862. Dim mRowBeforeSave As Integer '保存前的行数
  863. Dim mOldName As String 'old grid text before edit
  864. Const mMsg1 = "考勤机未打开!"
  865. Const mMsg2 = "线路出现严重故障,请检查!"
  866. Const mMsg3 = "数据传输出错!"
  867. Const mMsg4 = "无数据可采集!"
  868. Const mMsg5 = "数据已采集完毕!"
  869. Const mRetryTimes = 3
  870. Private Const mIntCollectCols = 7
  871. Private Const mIntLeaveCols = 12
  872. Private Const mIntAbsentCols = 11
  873. Private Const mstrSHour = "8"
  874. Private Const mstrEHour = "13"
  875. Private Const mstrMinute = "0"
  876. Private Const mstrAbsent = "缺席"
  877. '*****cols of grid
  878. 'Private Const mCollectCols = 7
  879. 'Private Const mLeaveCols = 11
  880. 'Private Const mAbsentCols = 10
  881. '*******cmdkq'其他同cmdEdit
  882. Private Const mRefresh = 6
  883. Private Const mCollect = 7
  884. '*****strdata
  885. 'Private Const mTotal = 1
  886. 'Private Const mReceive = 2
  887. 'Private Const mDate = 3
  888. 'Private Const mTime = 4
  889. '******msfGrid
  890. Private Const mGridWorkNo = 0
  891. Private Const mGridName = 1
  892. Private Const mGridSex = 2
  893. Private Const mGridDept = 3
  894. Private Const mGridTitle = 4
  895. Private Const mGridStartDate = 5
  896. Private Const mGridStartTime = 6
  897. Private Const mGridEndDate = 7
  898. Private Const mGridEndTime = 8
  899. Private Const mGridType = 9
  900. Private Const mGridAllowMan = 10
  901. Private Const mGridReason = 11
  902. '******txtKQ
  903. Private Const mtxtWorkNo = 0
  904. Private Const mtxtName = 1
  905. Private Const mtxtSex = 2
  906. Private Const mtxtAge = 3
  907. Private Const mtxtTitle = 4
  908. Private Const mtxtDept = 5
  909. Private Const mtxtSDate = 6
  910. Private Const mtxtSHour = 7
  911. Private Const mtxtSMinute = 8
  912. Private Const mtxtEDate = 9
  913. Private Const mtxtEHour = 10
  914. Private Const mtxtEMinute = 11
  915. Private Const mtxtReason = 12
  916. Private Const mtxtAllowMan = 13
  917. '*******VScrollHour
  918. Private Const mVSStart = 0
  919. Private Const mVSEnd = 1
  920. Dim mKqRecord() As KQTemp '采集临时数据
  921. Dim mColNotRegister() As KQTemp  '未登记的卡号
  922. Dim mColInValidCard() As KQTemp '流通中的无效卡
  923. Const mHasInValidTop = 3165
  924. Const mHasInValidHeight = 4680
  925. Const mValidTop = 790
  926. Const mValidHeight = 6955
  927. Const mMsg6 = "您确定不保存吗?"
  928. Const mMsg7 = "出现某一未知的错误!!数据保存未成功!"
  929. Const mMsg8 = "您确定要删除该条记录吗?"
  930. Const mMsg9 = "抱歉,删除不成功!"
  931. '***frmdetail.mtitle
  932. Const mstrDui = "对"
  933. Const mstrEmployee = "的员工"
  934. Const mstrDoPlan = "进行排班"
  935. Private Sub cboEdit_GotFocus()
  936.     msfGrid.ScrollBars = flexScrollBarNone
  937. End Sub
  938. 'Private Sub cboEdit_LostFocus()
  939. '    cboEdit.Visible = False
  940. '    msfGrid.ScrollBars = flexScrollBarBoth
  941. '    msfGrid.SetFocus
  942. 'End Sub
  943. Private Sub cmdEdit_Click(Index As Integer)
  944.     Dim strTmp As String
  945.     Select Case Index
  946.         Case gCMDAPPEND
  947.             Dim blnIsToGo As Boolean
  948.             blnIsToGo = True
  949.             If Not mblnIsAdd Then
  950.                 strTmp = gSTRCANCEL
  951.                 AddAction
  952.                 InitxtEdit
  953.                 txtKQ(mtxtWorkNo).SetFocus
  954.             Else
  955.                 If mblnIsNeedSave Then
  956.                     If MsgBox(mMsg6, vbQuestion + _
  957.                         vbYesNo + vbDefaultButton2, gTitle) _
  958.                         = vbNo Then
  959.                         blnIsToGo = False
  960.                     End If
  961.                 End If
  962.                 If blnIsToGo Then
  963.                     strTmp = gSTRAPPEND
  964.                     InitxtEdit
  965.                     ChangeColorFortxtKQ False
  966.                     mblnIsNeedSave = False
  967.                     RefreshButton cmdEdit, gCMDEDITCANCEL
  968.                 Else
  969.                     strTmp = gSTRCANCEL
  970.                 End If
  971.             End If
  972.             strTmp = strTmp & "(&A)"
  973.             cmdEdit(gCMDAPPEND).Caption = strTmp
  974.             If blnIsToGo Then
  975.                 mblnIsAdd = Not mblnIsAdd
  976.             End If
  977.         Case gCMDSAVE
  978.             If SaveDataToDatabase Then
  979.                AfterSave
  980.                strTmp = gSTRMODIFY & "&M"
  981.                cmdEdit(gCMDEDIT).Caption = strTmp
  982.                mnuEditModify.Caption = strTmp
  983.             End If
  984.         Case gCMDEDIT
  985.             If Not mblnIsModify Then
  986.                 strTmp = gSTRRESET
  987.                 ToModify
  988.             Else
  989.                 strTmp = gSTRMODIFY
  990.                 AfterSave
  991.             End If
  992.             strTmp = strTmp & "(&M)"
  993.             mnuEditModify.Caption = strTmp
  994.             cmdEdit(gCMDEDIT).Caption = strTmp
  995.         Case gCMDDELETE
  996.             If DeleteForLeave Then
  997.                 If Not txtKQ(mtxtWorkNo).Locked Then InitxtEdit
  998.                 RefreshButton cmdEdit, gCMDEDITNORMAL
  999.             End If
  1000.         Case gCMDQUERY
  1001.         Case gCMDRETURN
  1002.             If Trim(txtKQ(mtxtWorkNo)) <> Empty Then
  1003.                 If MsgBox("您还没保存,要保存吗?", vbQuestion + vbYesNo, gTitle) = vbYes Then
  1004.                     cmdEdit_Click gCMDSAVE
  1005.                     Exit Sub
  1006.                 End If
  1007.             End If
  1008.             Unload Me
  1009.         Case mRefresh
  1010.             RefreshHistory
  1011.     End Select
  1012. End Sub
  1013. Private Function DeleteForLeave() As Boolean
  1014.     Dim strWorkNo As String
  1015.     Dim strSDate As String
  1016.     Dim strSTime As String
  1017.     Dim strEDate As String
  1018.     Dim strETime As String
  1019.     Dim Sql As String
  1020.     
  1021.     If MsgBox(mMsg8, _
  1022.         vbQuestion + vbOKCancel + vbDefaultButton2, _
  1023.         gTitle) = vbCancel Then Exit Function
  1024.     
  1025.     On Error GoTo DeleteErr
  1026.     With msfGrid
  1027.         strWorkNo = Trim(.TextMatrix(.row, mGridWorkNo))
  1028.         strSDate = Trim(.TextMatrix(.row, mGridStartDate))
  1029.         strSTime = Trim(.TextMatrix(.row, mGridStartTime))
  1030.         strEDate = Trim(.TextMatrix(.row, mGridEndDate))
  1031.         strETime = Trim(.TextMatrix(.row, mGridEndTime))
  1032.         
  1033.         Sql = "Update "
  1034.         If mStatus = gMAINLEAVE Then
  1035.             Sql = Sql & "Leave"
  1036.         ElseIf mStatus = gMAINABSENT Then
  1037.             Sql = Sql & "Absent"
  1038.         End If
  1039.         Sql = Sql & " set F_DelFlag=" & gTRUE _
  1040.                 & " where WorkNo ='" & strWorkNo _
  1041.                 & "' and StartDate='" & strSDate _
  1042.                 & "' and StartTime='" & strSTime _
  1043.                 & "' and EndDate='" & strEDate _
  1044.                 & "' and EndTime='" & strETime & "'"
  1045.         gDataBase.Execute Sql
  1046.         DeleteForLeave = True
  1047.         If .Rows = .FixedRows + 1 Then
  1048.             .Rows = .FixedRows
  1049.         Else
  1050.             .RemoveItem .row
  1051.         End If
  1052.     End With
  1053.     
  1054.     Exit Function
  1055. DeleteErr:
  1056.     MsgBox mMsg9 & vbCrLf & vbCrLf & Err.Description, vbExclamation, gTitle
  1057.     Err.Clear
  1058.     DeleteForLeave = False
  1059. End Function
  1060. Private Sub ToModify()
  1061.     With msfGrid
  1062.         Dim i As Integer
  1063.         Dim CellStr As String
  1064.         mblnIsModify = True
  1065.         For i = 0 To .Cols - 1
  1066.             CellStr = Trim(.TextMatrix(.row, i))
  1067.             Select Case i
  1068.                 Case 0 To 2
  1069.                     txtKQ(i) = CellStr
  1070.                 Case 3
  1071.                     txtKQ(mtxtDept) = CellStr
  1072.                 Case 4
  1073.                     txtKQ(mtxtTitle) = CellStr
  1074.                 Case mGridStartDate
  1075.                     txtKQ(mtxtSDate) = CellStr
  1076.                 Case mGridStartTime
  1077.                     txtKQ(mtxtSHour) = Left(CellStr, 2)
  1078.                     txtKQ(mtxtSMinute) = Right(CellStr, 2)
  1079.                 Case mGridEndDate
  1080.                     txtKQ(mtxtEDate) = CellStr
  1081.                 Case mGridEndTime
  1082.                     txtKQ(mtxtEHour) = Left(CellStr, 2)
  1083.                     txtKQ(mtxtEMinute) = Right(CellStr, 2)
  1084.                 Case mGridType
  1085.                     LookForCboByStr cboKQ, CellStr
  1086.                 Case mGridAllowMan
  1087.                     txtKQ(mtxtAllowMan) = CellStr
  1088.                 Case mGridReason
  1089.                     txtKQ(mtxtReason) = CellStr
  1090.             End Select
  1091.         Next
  1092.     End With
  1093.     ChangeColorFortxtKQ True
  1094.     RefreshButton cmdEdit, gCMDEDIT
  1095.     cmdEdit(mRefresh).Enabled = False
  1096.     txtKQ(mtxtWorkNo).Locked = True
  1097.     txtKQ(mtxtSDate).SetFocus
  1098. End Sub
  1099. Private Sub AfterSave()
  1100.     InitxtEdit
  1101.     ChangeColorFortxtKQ False
  1102.     RefreshButton cmdEdit, gCMDEDITNORMAL
  1103.     cmdEdit(mRefresh).Enabled = True
  1104.     mblnIsModify = False
  1105.     mblnIsAdd = False
  1106.     mblnIsNeedSave = False
  1107.     cmdEdit(gCMDAPPEND).Caption = gSTRAPPEND & "&A"
  1108. End Sub
  1109. Private Function SaveDataToDatabase() As Boolean
  1110.     Dim strWorkNo As String
  1111.     Dim strAllowMan As String
  1112.     Dim strSDate As String
  1113.     Dim strSTime As String
  1114.     Dim strEDate As String
  1115.     Dim strETime As String
  1116.     Dim intLeaveType As Integer
  1117.     Dim strReason As String
  1118.     Dim isTrans As Boolean
  1119.     
  1120.     strWorkNo = Trim(txtKQ(mtxtWorkNo))
  1121.     strAllowMan = Trim(txtKQ(mtxtAllowMan))
  1122.     strSDate = Trim(txtKQ(mtxtSDate))
  1123.     strSTime = Format(Trim(txtKQ(mtxtSHour)), "00") & ":" _
  1124.         & Format(Trim(txtKQ(mtxtSMinute)), "00")
  1125.     strEDate = Trim(txtKQ(mtxtEDate))
  1126.     strETime = Format(Trim(txtKQ(mtxtEHour)), "00") & ":" _
  1127.         & Format(Trim(txtKQ(mtxtEMinute)), "00")
  1128.     strReason = Trim(txtKQ(mtxtReason))
  1129.     getItemData cboKQ, intLeaveType
  1130.     
  1131.     If Not mblnIsModify Then
  1132.         If strWorkNo = Empty Then
  1133.             MsgBox "工号不能为空,请输入!!", , gTitle
  1134.             SaveDataToDatabase = False
  1135.             txtKQ(mtxtWorkNo).SetFocus
  1136.             Exit Function
  1137.         Else
  1138.             If Trim(txtKQ(mtxtName)) = Empty Then
  1139.                 MsgBox "无效的工号,请核对后重新输入!!", , gTitle
  1140.                 SaveDataToDatabase = False
  1141.                 txtKQ(mtxtWorkNo).SetFocus
  1142.                 Exit Function
  1143.             End If
  1144.         End If
  1145.     End If
  1146.     
  1147.     If strAllowMan = Empty Then
  1148.         If mStatus = gMAINLEAVE Then
  1149.             MsgBox "没有批准人怎么能准假呢?,请输入!!", , gTitle
  1150.         ElseIf mStatus = gMAINABSENT Then
  1151.             MsgBox "批准人不能为空,请输入!!", , gTitle
  1152.         End If
  1153.         SaveDataToDatabase = False
  1154.         txtKQ(mtxtAllowMan).SetFocus
  1155.         Exit Function
  1156.     End If
  1157.     
  1158.     If strSDate = Empty Then
  1159.         MsgBox "起始日期不能为空,请输入!!", , gTitle
  1160.         SaveDataToDatabase = False
  1161.         txtKQ(mtxtSDate).SetFocus
  1162.         Exit Function
  1163.     End If
  1164.     If strEDate = Empty Then
  1165.         MsgBox "截至日期不能为空,请输入!!", , gTitle
  1166.         SaveDataToDatabase = False
  1167.         txtKQ(mtxtEDate).SetFocus
  1168.         Exit Function
  1169.     End If
  1170.     
  1171.     If (strSDate & strSTime) >= (strEDate & strETime) Then
  1172.         MsgBox "起始日期时间不能大于或等于截至日期时间!!", , gTitle
  1173.         SaveDataToDatabase = False
  1174.         txtKQ(mtxtSDate).SetFocus
  1175.         Exit Function
  1176.     End If
  1177.     
  1178.     If Not HasThisTable(gPlanTableName) Then
  1179.         If Not CreatePlanTable Then
  1180.             MsgBox mMsg7, vbCritical, gTitle
  1181.             SaveDataToDatabase = False
  1182.             Exit Function
  1183.         End If
  1184.     End If
  1185.     
  1186.     Dim strOperateTime As String
  1187.     strOperateTime = Format(Now, "yyyy-mm-dd hh:mm")
  1188.     
  1189.     Dim Rst As Recordset
  1190.     If mStatus = gMAINLEAVE Then
  1191.         Set Rst = gDataBase.OpenRecordset("Leave")
  1192.     ElseIf mStatus = gMAINABSENT Then
  1193.         Set Rst = gDataBase.OpenRecordset("Absent")
  1194.     End If
  1195.     
  1196.     On Error GoTo SaveErr
  1197.     
  1198.     BeginTrans
  1199.     isTrans = True
  1200.     If Not mblnIsModify Then
  1201.         Rst.AddNew
  1202.         Rst!WorkNo = strWorkNo
  1203.     Else
  1204.         Rst.Edit
  1205.     End If
  1206.     With Rst
  1207.         !StartDate = strSDate
  1208.         !StartTime = strSTime
  1209.         !EndDate = strEDate
  1210.         !EndTime = strETime
  1211.         !UserID = gUserID
  1212.         !AllowMan = strAllowMan
  1213.         !OperateTime = strOperateTime
  1214.         If mStatus = gMAINLEAVE Then
  1215.             !TypeID = intLeaveType
  1216.             !Reason = strReason
  1217.         ElseIf mStatus = gMAINABSENT Then
  1218.             !isEvection = intLeaveType
  1219.         End If
  1220.         .Update
  1221.     End With
  1222.     Rst.Close
  1223.     
  1224. '    UpdateShiftPlan strSDate, strEDate, Trim(cboKQ.Text)
  1225.     
  1226.     CommitTrans
  1227.     isTrans = False
  1228.     Set Rst = Nothing
  1229.     SaveDataToDatabase = True
  1230.     
  1231.     If Not mblnIsModify Then
  1232.         Dim StrAdd As String
  1233.         With msfGrid
  1234.             StrAdd = strWorkNo & vbTab & Trim(txtKQ(mtxtName)) _
  1235.                 & vbTab & Trim(txtKQ(mtxtSex)) & vbTab _
  1236.                 & Trim(txtKQ(mtxtDept)) & vbTab _
  1237.                 & Trim(txtKQ(mtxtTitle)) & vbTab _
  1238.                 & strSDate & vbTab & strSTime & vbTab _
  1239.                 & strEDate & vbTab & strETime & vbTab _
  1240.                 & Trim(cboKQ.Text) & vbTab _
  1241.                 & strAllowMan & vbTab
  1242.             If mStatus = gMAINLEAVE Then
  1243.                 StrAdd = StrAdd & strReason
  1244.             End If
  1245.             .AddItem StrAdd
  1246.             .TopRow = .Rows - 1
  1247.         End With
  1248.     Else
  1249.         With msfGrid
  1250.             .TextMatrix(.row, mGridStartDate) = strSDate
  1251.             .TextMatrix(.row, mGridStartTime) = strSTime
  1252.             .TextMatrix(.row, mGridEndDate) = strEDate
  1253.             .TextMatrix(.row, mGridEndTime) = strETime
  1254.             .TextMatrix(.row, mGridType) = Trim(cboKQ.Text)
  1255.             .TextMatrix(.row, mGridAllowMan) = strAllowMan
  1256.             If mStatus = gMAINLEAVE Then
  1257.                 .TextMatrix(.row, mGridReason) = strReason
  1258.             End If
  1259.         End With
  1260.     End If
  1261.     DoPlan strWorkNo, Trim(txtKQ(mtxtName)), Trim(txtKQ(mtxtDept))
  1262.     'MsgBox "恭喜!数据保存成功,请修改排班表", vbInformation, gTitle
  1263.     Exit Function
  1264. SaveErr:
  1265.     If isTrans Then
  1266.         Rollback
  1267.         MsgBox "数据未保存成功!请再试!! " & vbCrLf _
  1268.             & vbCrLf & Err.Description, vbExclamation, gTitle
  1269.     Else
  1270.         MsgBox Err.Description, vbExclamation, gTitle
  1271.     End If
  1272.     Err.Clear
  1273.     SaveDataToDatabase = False
  1274.    ' Rst.CancelUpdate
  1275. End Function
  1276. Private Sub DoPlan(strWorkNo As String, strName As String, strDeptName As String)
  1277.     Dim MyfrmDetail As frmDetail
  1278.     Set MyfrmDetail = New frmDetail
  1279.     Dim strTemp As String
  1280.     With MyfrmDetail
  1281.             .mDeptID = Empty
  1282.             .mWorkNo = strWorkNo
  1283.             strTemp = mstrDui
  1284.             strTemp = strTemp & "[" & strDeptName & "]" & mstrEmployee _
  1285.                      & "[" & strName & "]"
  1286.             .mTitle = strTemp & mstrDoPlan
  1287.             .mIsToLook = False
  1288.         .Show vbModal
  1289.         'If .mNeedToRefresh Then tvwPlan_NodeClick mNode
  1290.         Unload MyfrmDetail
  1291.     End With
  1292. End Sub
  1293. 'Private Sub UpdateShiftPlan(strSDate As String, strEDate As String, strAbsentType As String)
  1294. '    Dim intStartDay As Integer
  1295. '    Dim intEndDay As Integer
  1296. '    intStartDay = CInt(Var(Right(strSDate, 2)))
  1297. '    intEndDay = CInt(Var(Right(strEDate, 2)))
  1298. '    Dim IntDay As Integer
  1299. '    Dim Sql As String
  1300. '    For IntDay = intStartDay To intEndDay
  1301. '        Sql = "update " & gPlanTableName & _
  1302. '            " set F_Shift="
  1303. '        If mStatus = gMAINLEAVE Then
  1304. '            Sql = Sql & GSHIFTLEAVEID
  1305. '        ElseIf mStatus = gMAINABSENT Then
  1306. '            If strAbsentType = GSHIFTEVECTIONSTR Then
  1307. '                Sql = Sql & GSHIFTEVECTIONID
  1308. '            ElseIf strAbsentType = GSHIFTMONEYSTR Then
  1309. '                Sql = Sql & GSHIFTMONEYID
  1310. '            End If
  1311. '        End If
  1312. '        Sql = Sql & " Where WorkNo='" & strWorkNo & _
  1313. '            "' and F_Day=" & IntDay
  1314. '        gDataBase.Execute Sql
  1315. '    Next
  1316. 'End Sub
  1317. Private Sub AddAction()
  1318.     RefreshButton cmdEdit, gCMDAPPEND
  1319.     ChangeColorFortxtKQ True
  1320. End Sub
  1321. Private Sub ChangeColorFortxtKQ(isEdit As Boolean)
  1322.     Dim i As Integer
  1323.     For i = 0 To txtKQ.Count - 1
  1324.         With txtKQ(i)
  1325.             ChangeBackColor txtKQ(i), isEdit
  1326.             Select Case i
  1327.                 'Case mtxtName, mtxtSex, mtxtAge, mtxtTitle, mtxtDept, mtxtSDate, mtxtEDate
  1328.                 Case mtxtWorkNo, mtxtSHour, mtxtSMinute, mtxtEHour, mtxtEMinute, mtxtAllowMan
  1329.                     .Locked = Not isEdit
  1330.                 Case mtxtReason
  1331.                     If mStatus = gMAINLEAVE Then
  1332.                         .Locked = Not isEdit
  1333.                     End If
  1334.             End Select
  1335.         End With
  1336.     Next
  1337.     With cboKQ
  1338.         .Enabled = isEdit
  1339.         ChangeBackColor cboKQ, isEdit
  1340.     End With
  1341.     For i = 0 To picHour.Count - 1
  1342.         ChangeBackColor picHour(i), isEdit
  1343.     Next
  1344.     For i = 0 To picMinite.Count - 1
  1345.         ChangeBackColor picMinite(i), isEdit
  1346.     Next
  1347.     
  1348.     For i = 0 To VScrollHour.Count - 1
  1349.         VScrollHour(i).Enabled = isEdit
  1350.     Next
  1351.     
  1352.     For i = 0 To VScrollMinite.Count - 1
  1353.         VScrollMinite(i).Enabled = isEdit
  1354.     Next
  1355.     
  1356.     If isEdit Then
  1357.         txtKQ(mtxtWorkNo).SetFocus
  1358.     End If
  1359. End Sub
  1360. Private Function getNowTime() As String
  1361.     getNowTime = Format(Now, "yyyy-mm-dd hh:mm:ss")
  1362. End Function
  1363. Private Sub IntoMain(Index As Integer)
  1364.     Select Case Index
  1365.         Case gMAINCOLLECT
  1366.             showMainPic True
  1367.         Case gMAINLEAVE, gMAINABSENT
  1368.             msfGrid.Visible = False
  1369.             showMainPic False, Index
  1370.             With msfGrid
  1371.                 If Index = gMAINLEAVE Then
  1372.                     .Cols = mIntLeaveCols
  1373.                     '.FormatString = mLeaveTitle
  1374.                 ElseIf Index = gMAINABSENT Then
  1375.                     .Cols = mIntAbsentCols
  1376.                     '.FormatString = mAbsentTitle
  1377.                 End If
  1378.                 iniGridRows msfGrid
  1379.             End With
  1380.             msfGrid.Visible = True
  1381.     End Select
  1382. End Sub
  1383. Private Sub iniGridRows(myGrid As MSFlexGrid)
  1384.     With myGrid
  1385.         .Rows = .FixedRows 'clear old data
  1386.         .Rows = gFIXEDROWS
  1387.     End With
  1388.     'RefreshHistory
  1389. End Sub
  1390. Private Sub RefreshHistory()
  1391.     'If (mStatus <> gMAINLEAVE) And (mStatus <> gMAINABSENT) Then Exit Sub
  1392.     Dim Rst As Recordset
  1393.     Dim Sql As String
  1394.     Sql = "Select  * from "
  1395.     If mStatus = gMAINLEAVE Then
  1396.         Sql = Sql & "QryLeave"
  1397.     ElseIf mStatus = gMAINABSENT Then
  1398.         Sql = Sql & "QryAbsent"
  1399.     ElseIf mStatus = gMAINCOLLECT Then
  1400.         Sql = Sql & "QryKqHistory"
  1401.     End If
  1402.     Sql = Sql & " where left(trim(OperateTime),10)='" & _
  1403.         Format(Now, "yyyy-mm-dd") & "' order by WorkNo"
  1404.     
  1405.     Set Rst = gDataBase.OpenRecordset(Sql, dbOpenSnapshot)
  1406.     Dim Str As String
  1407.     With Rst
  1408.         While Not .EOF
  1409.             Str = Str & IIf(IsNull(!WorkNo), "", Trim(!WorkNo)) _
  1410.                 & vbTab & IIf(IsNull(!Name), "", Trim(!Name)) _
  1411.                 & vbTab & IIf(IsNull(!Sex), "", Trim(!Sex)) _
  1412.                 & vbTab & IIf(IsNull(!DeptName), "", Trim(!DeptName)) _
  1413.                 & vbTab & IIf(IsNull(!TitleName), "", Trim(!TitleName))
  1414.             If mStatus = gMAINCOLLECT Then
  1415.                 Str = Str & vbTab & IIf(IsNull(!KqDate), "", Trim(!KqDate)) _
  1416.                     & vbTab & IIf(IsNull(!KqTime), "", Trim(!KqTime))
  1417.             Else
  1418.                 Str = Str & vbTab & IIf(IsNull(!StartDate), "", Trim(!StartDate)) _
  1419.                     & vbTab & IIf(IsNull(!StartTime), "", Trim(!StartTime)) _
  1420.                     & vbTab & IIf(IsNull(!EndDate), "", Trim(!EndDate)) _
  1421.                     & vbTab & IIf(IsNull(!EndTime), "", Trim(!EndTime)) & vbTab
  1422.                 If mStatus = gMAINLEAVE Then
  1423.                     Str = Str & IIf(IsNull(!TypeName), "", Trim(!TypeName)) _
  1424.                         & vbTab & IIf(IsNull(!AllowMan), "", Trim(!AllowMan)) _
  1425.                         & vbTab & IIf(IsNull(!Reason), "", Trim(!Reason))
  1426.                 ElseIf mStatus = gMAINABSENT Then
  1427.                     Dim tmpMyStr As String
  1428.                     If Not IsNull(!isEvection) Then
  1429.                         If !isEvection Then
  1430.                             tmpMyStr = GSHIFTEVECTIONSTR
  1431.                         Else
  1432.                             tmpMyStr = GSHIFTMONEYSTR
  1433.                         End If
  1434.                     Else
  1435.                         tmpMyStr = Empty
  1436.                     End If
  1437.                     Str = Str & tmpMyStr & vbTab _
  1438.                         & IIf(IsNull(!AllowMan), "", Trim(!AllowMan))
  1439.                 End If
  1440.             End If
  1441.             
  1442.             If Not .EOF Then
  1443.                 Str = Str & vbCr
  1444.             End If
  1445.             .MoveNext
  1446.         Wend
  1447.     End With
  1448.     
  1449.     Dim intCols As Integer
  1450.     Dim intRows As Integer
  1451.     intRows = Rst.RecordCount + msfGrid.FixedRows
  1452.     If mStatus = gMAINLEAVE Then
  1453.         intCols = mIntLeaveCols
  1454.     ElseIf mStatus = gMAINABSENT Then
  1455.         intCols = mIntAbsentCols
  1456.     ElseIf mStatus = gMAINCOLLECT Then
  1457.         intCols = mIntCollectCols
  1458.     End If
  1459.     ClipToGrid msfGrid, Str, intRows, intCols
  1460.     Rst.Close
  1461.     Set Rst = Nothing
  1462. End Sub
  1463. Private Sub showMainPic(isTrue As Boolean, Optional MainStatus As Integer = gMAINCOLLECT)
  1464.     picMain.Visible = isTrue
  1465.     picEdit.Visible = Not isTrue
  1466.     fraEdit.Visible = Not isTrue
  1467.     
  1468.     With msfGrid
  1469.         If isTrue Then
  1470.             If UBound(mColNotRegister) > 0 _
  1471.                 Or UBound(mColInValidCard) > 0 Then
  1472.                 fraList.Visible = True
  1473.                 .Top = mHasInValidTop
  1474.                 .Height = mHasInValidHeight
  1475.             Else
  1476.                 .Top = mValidTop
  1477.                 .Height = mValidHeight
  1478.             End If
  1479.         Else
  1480.             If fraList.Visible Then fraList.Visible = False
  1481.             If MainStatus = gMAINABSENT Then
  1482.                 txtKQ(mtxtReason).Visible = False
  1483.                 fraEdit.Height = 2235 - 495
  1484.                 .Top = 2670
  1485.                 .Height = 5175
  1486.             Else
  1487.                 txtKQ(mtxtReason).Visible = True
  1488.                 fraEdit.Height = 2235
  1489.                 .Top = mHasInValidTop
  1490.                 .Height = mHasInValidHeight
  1491.             End If
  1492.         End If
  1493.     End With
  1494.     
  1495.     Dim tmpStr As String
  1496.     tmpStr = "类别"
  1497.     If MainStatus = gMAINLEAVE Or MainStatus = gMAINABSENT Then
  1498.         If MainStatus = gMAINLEAVE Then
  1499.             tmpStr = GSHIFTLEAVESTR & tmpStr
  1500.             FillCbo cboKQ, aLeaveType
  1501.             If Not txtKQ(mtxtReason).Visible Then
  1502.                 txtKQ(mtxtReason).Visible = True
  1503.                 lblReason.Visible = True
  1504.             End If
  1505.         Else
  1506.             cboKQ.Clear
  1507.             tmpStr = mstrAbsent & tmpStr
  1508.             With cboKQ
  1509.                 .AddItem GSHIFTEVECTIONSTR
  1510.                 .ItemData(.NewIndex) = -1
  1511.                 .AddItem GSHIFTMONEYSTR
  1512.                 .ItemData(.NewIndex) = 0
  1513.                 .ListIndex = 0
  1514.             End With
  1515.             If txtKQ(mtxtReason).Visible Then
  1516.                 txtKQ(mtxtReason).Visible = False
  1517.                 lblReason.Visible = False
  1518.             End If
  1519.         End If
  1520.         Label1(9).Caption = tmpStr
  1521.         'txtKQ(mtxtworkno).SetFocus
  1522.     End If
  1523.     
  1524.     mStatus = MainStatus
  1525. End Sub
  1526. Private Sub cmdKq_Click(Index As Integer)
  1527.     Select Case Index
  1528.         Case mCollect
  1529.             Dim Fr As frmSelPos
  1530.             Dim isOK As Boolean
  1531.             Set Fr = New frmSelPos
  1532.             Fr.Show 1
  1533.             isOK = Fr.mIsOk
  1534.             mPosName = Fr.mPosName
  1535.             Unload Fr
  1536.             Set Fr = Nothing
  1537.             If Not isOK Then Exit Sub
  1538.             If CollectDataFromPos Then
  1539.                 WriteTempToKq
  1540.             End If
  1541.         Case mRefresh
  1542.             RefreshHistory
  1543.         Case gCMDAPPEND
  1544.             mblnCollectModify = False
  1545.             cmdKq(gCMDAPPEND).Enabled = False
  1546.             AppendToGrid
  1547.             cmdKq(gCMDSAVE).Enabled = True
  1548.         Case gCMDSAVE
  1549.             SaveCollect
  1550.         Case gCMDEDIT
  1551.         Case gCMDDELETE
  1552.             DeleteCollect
  1553.         Case gCMDQUERY
  1554.         Case gCMDRETURN
  1555.             Unload Me
  1556.     End Select
  1557. End Sub
  1558. Private Sub DeleteCollect()
  1559.     Dim strWorkNo As String
  1560.     Dim strKqDate As String
  1561.     Dim strKqTime As String
  1562.     Dim Sql As String
  1563.     On Error GoTo DeleteErr
  1564.     With msfGrid
  1565.         strWorkNo = Trim(.TextMatrix(.row, mGridWorkNo))
  1566.         strKqDate = Trim(.TextMatrix(.row, mGridStartDate))
  1567.         strKqTime = Trim(.TextMatrix(.row, mGridStartTime))
  1568.         Sql = "update KqHistory set " _
  1569.             & " F_DelFlag=" & gTRUE _
  1570.             & " where WorkNo='" & strWorkNo & "' " _
  1571.             & " and KqDate='" & strKqDate & "' " _
  1572.             & " and KqTime='" & strKqTime & "'"
  1573.         gDataBase.Execute Sql
  1574.     End With
  1575.     With msfGrid
  1576.         If .Rows = .FixedRows + 1 Then
  1577.             .Rows = .FixedRows
  1578.         Else
  1579.             .RemoveItem .row
  1580.         End If
  1581.     End With
  1582.     Exit Sub
  1583. DeleteErr:
  1584.     MsgBox "抱歉,删除不成功" & vbCrLf & Err.Description, vbInformation, gTitle
  1585.     Err.Clear
  1586. End Sub
  1587. Private Sub AppendToGrid()
  1588.     With msfGrid
  1589.         .Rows = .Rows + 1
  1590.         .row = .Rows - 1
  1591.         .col = mGridWorkNo
  1592.         SetTxtPosition msfGrid, txtEdit
  1593.     End With
  1594. End Sub
  1595. Private Sub Form_Load()
  1596.     SetFormPosition
  1597.     ReDim mColNotRegister(0)
  1598.     mColNotRegister(0).WorkNo = ""
  1599.     ReDim mColInValidCard(0)
  1600.     mColInValidCard(0).WorkNo = ""
  1601.     
  1602.     iniTitle
  1603.     SetGridColor msfGrid
  1604.     
  1605.     If mMenuIndex = gMAINCOLLECT Then
  1606.         lstNotRegister.BackColor = gGridBackColor
  1607.         lstInValidCard.BackColor = gGridBackColor
  1608.         RefreshButton cmdKq, gCMDEDITNORMAL
  1609.     Else
  1610.         ChangeColorFortxtKQ False
  1611.         InitxtEdit 'inidate
  1612.         RefreshButton cmdEdit, gCMDEDITNORMAL
  1613.     End If
  1614.     
  1615.     IntoMain mMenuIndex
  1616.     msfGrid.FormatString = mFormatString '   'mAbsentTitle 'mLeaveTitle
  1617.     
  1618. End Sub
  1619. Private Sub SetFormPosition()
  1620.     Me.Left = (12000 - Me.Width) / 2
  1621.     Me.Top = (9000 - Me.Height)
  1622. End Sub
  1623. Private Function getToday() As String
  1624.     getToday = Format(Now, "yyyy-mm-dd")
  1625. End Function
  1626. 'Private Sub setStatusBar(Index As Integer, MsgStr As String)
  1627. '    sbrData.Panels(Index).Text = MsgStr
  1628. 'End Sub
  1629. Private Sub lstNotRegister_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  1630.     With lstNotRegister
  1631.         If .ListCount <= 0 Then Exit Sub
  1632.         If Button = 2 Then
  1633.             'RefreshCard mnuEditCard, Val(.TextMatrix(.row, .Cols - 1))
  1634.             'Refresh
  1635.             Dim strWorkNo As String
  1636.             strWorkNo = Left(Trim(.Text), 4)
  1637.             RefreshmnuList strWorkNo
  1638.             PopupMenu mnuList
  1639.         End If
  1640.     End With
  1641. End Sub
  1642. Private Sub RefreshmnuList(strWorkNo As String)
  1643.     Dim Rst As Recordset
  1644.     Dim blnIsRegister As Boolean
  1645.     Set Rst = gDataBase.OpenRecordset("select * from Employee" _
  1646.         & " where WorkNo='" & Trim(strWorkNo) _
  1647.         & "' order by WorkNo", dbOpenSnapshot)
  1648.     blnIsRegister = Rst.RecordCount <= 0
  1649.     Rst.Close
  1650.     Set Rst = Nothing
  1651.     
  1652.     mnuListAppend.Enabled = Not blnIsRegister
  1653.     mnuListRegister.Enabled = blnIsRegister
  1654. End Sub
  1655. Private Sub mnuListAppend_Click()
  1656.     If Trim(lstNotRegister.Text) = Empty Then Exit Sub
  1657.     If MsgBox("是否要把此条记录添加到考勤数据采集中?", _
  1658.         vbQuestion + vbYesNo, gTitle) = vbNo Then Exit Sub
  1659.     Dim strWorkNo As String
  1660.     Dim strKqDate As String
  1661.     Dim strKqTime As String
  1662.     Dim intTemp As Integer
  1663.     Dim strList As String
  1664.     Dim intListIndex As Integer
  1665.     intListIndex = lstNotRegister.ListIndex
  1666.     strList = Trim(lstNotRegister.Text)
  1667.     strWorkNo = Left(strList, 4)
  1668.     strList = Trim(Mid(strList, 5))
  1669.     intTemp = InStr(1, strList, " ", vbTextCompare)
  1670.     strKqDate = Trim(Left(strList, intTemp))
  1671.     strKqTime = Trim(Mid(strList, intTemp))
  1672.     
  1673.     Dim Rst As Recordset
  1674.     Dim EmpRst As Recordset
  1675.     Dim strIn As String
  1676.     
  1677.     On Error GoTo ErrHandle
  1678.     Set Rst = gDataBase.OpenRecordset("KqHistory")
  1679.     Set EmpRst = gDataBase.OpenRecordset("Select * from " _
  1680.         & " QryEmployee where WorkNo='" & strWorkNo & "'" & _
  1681.         " order by WorkNo", dbOpenSnapshot)
  1682.     If EmpRst.RecordCount > 0 Then
  1683.         Rst.AddNew
  1684.         Rst!WorkNo = strWorkNo
  1685.         Rst!KqDate = strKqDate
  1686.         Rst!KqTime = strKqTime
  1687.         Rst.Update
  1688.         
  1689.         With EmpRst
  1690.             strIn = strWorkNo & vbTab _
  1691.                 & !Name & vbTab & !Sex & vbTab _
  1692.                 & !DeptName & vbTab & !TitleName & vbTab _
  1693.                 & strKqDate & vbTab & strKqTime
  1694.         End With
  1695.         msfGrid.AddItem strIn
  1696.         lstNotRegister.RemoveItem intListIndex
  1697.     End If
  1698.     Rst.Close
  1699.     Set Rst = Nothing
  1700.     EmpRst.Close
  1701.     Set EmpRst = Nothing
  1702.     Exit Sub
  1703.     
  1704. ErrHandle:
  1705.     MsgBox Err.Description, vbInformation, gTitle
  1706.     Err.Clear
  1707.     Exit Sub
  1708.     'End If
  1709. End Sub
  1710. Private Sub mnuListRegister_Click()
  1711.     If lstNotRegister.ListCount <= 0 Then Exit Sub
  1712.     If MsgBox("是否要对此卡进行登记?", _
  1713.         vbQuestion + vbYesNo, gTitle) = vbNo Then Exit Sub
  1714.     With frmEmploy
  1715.         .Show 0, Me
  1716.         .cmdEdit_Click 0
  1717.         .txtEmp(0) = Left(Trim(lstNotRegister.Text), 4)
  1718.     End With
  1719. End Sub
  1720. Private Sub mSetColor_Click()
  1721. End Sub
  1722. Private Sub mSetOption_Click()
  1723. End Sub
  1724. Private Sub medDate_GotFocus()
  1725.     msfGrid.Enabled = False
  1726.     medDate.SelStart = 0
  1727.     medDate.SelLength = Len(medDate.Text)
  1728. End Sub
  1729. Private Sub medDate_KeyDown(KeyCode As Integer, Shift As Integer)
  1730.     Select Case KeyCode
  1731.         Case vbKeyReturn
  1732.             Dim Str As String
  1733.             Str = Trim(medDate.Text)
  1734.             With msfGrid
  1735.                 If Str <> Empty Then
  1736.                     .TextMatrix(.row, mGridStartDate) = Str
  1737.                     medDate.Visible = False
  1738.                     If Not mblnCollectModify Then
  1739.                         .col = mGridStartTime
  1740.                         SetMedPosition msfGrid, medTime, False
  1741.                     Else
  1742.                         If Str <> mOldKqDate Then
  1743.                             If SaveCollectByModify Then
  1744.                                 mblnCollectModify = False
  1745.                             Else
  1746.                                 .TextMatrix(.row, mGridStartDate) = mOldKqDate
  1747.                             End If
  1748.                         End If
  1749.                         msfGrid.Enabled = True
  1750.                     End If
  1751.                 End If
  1752.             End With
  1753.         Case vbKeyEscape
  1754.             If mblnCollectModify Then
  1755.                 If medDate.Visible Then medDate.Visible = False
  1756.                 If Not msfGrid.Enabled Then msfGrid.Enabled = True
  1757.                 msfGrid.SetFocus
  1758.             End If
  1759.     End Select
  1760. End Sub
  1761. Private Function SaveCollectByModify() As Boolean
  1762.     Dim strWorkNo As String
  1763.     Dim strKqDate As String
  1764.     Dim strKqTime As String
  1765.     Dim Sql As String
  1766.     On Error GoTo SaveErr
  1767.     With msfGrid
  1768.         strWorkNo = Trim(.TextMatrix(.row, mGridWorkNo))
  1769.         strKqDate = Trim(.TextMatrix(.row, mGridStartDate))
  1770.         strKqTime = Trim(.TextMatrix(.row, mGridStartTime))
  1771.         Sql = "update KqHistory set " _
  1772.             & " KqDate='" & strKqDate & "'," _
  1773.             & " KqTime='" & strKqTime & "' " _
  1774.             & " where WorkNo='" & strWorkNo & "' " _
  1775.             & " and KqDate='" & mOldKqDate & "' " _
  1776.             & " and KqTime='" & mOldKqTime & "'"
  1777.         gDataBase.Execute Sql
  1778.     End With
  1779.     SaveCollectByModify = True
  1780.     Exit Function
  1781. SaveErr:
  1782.     MsgBox "抱歉,保存不成功" & vbCrLf & Err.Description, vbInformation, gTitle
  1783.     Err.Clear
  1784.     SaveCollectByModify = False
  1785. End Function
  1786. Private Sub medDate_LostFocus()
  1787.     medDate.Visible = False
  1788. End Sub
  1789. Private Sub medTime_GotFocus()
  1790.     msfGrid.Enabled = False
  1791.     medTime.SelStart = 0
  1792.     medTime.SelLength = Len(medTime.Text)
  1793. End Sub
  1794. Private Sub medTime_KeyDown(KeyCode As Integer, Shift As Integer)
  1795.     Select Case KeyCode
  1796.         Case vbKeyReturn
  1797.             Dim Str As String
  1798.             Str = Trim(medTime.Text)
  1799.             With msfGrid
  1800.                 If Str <> Empty Then
  1801.                     .TextMatrix(.row, mGridStartTime) = Str
  1802.                     medTime.Visible = False
  1803.                     If Not mblnCollectModify Then
  1804.                         cmdKq_Click gCMDSAVE
  1805.                     Else
  1806.                         If Str <> mOldKqTime Then
  1807.                             If SaveCollectByModify Then
  1808.                                 mblnCollectModify = False
  1809.                             Else
  1810.                                 .TextMatrix(.row, mGridStartTime) = mOldKqTime
  1811.                             End If
  1812.                         End If
  1813.                         msfGrid.Enabled = True
  1814.                     End If
  1815.                 End If
  1816.             End With
  1817.         Case vbKeyEscape
  1818.             If mblnCollectModify Then
  1819.                 If medTime.Visible Then medTime.Visible = False
  1820.                 If Not msfGrid.Enabled Then msfGrid.Enabled = True
  1821.                 msfGrid.SetFocus
  1822.             End If
  1823.     End Select
  1824. End Sub
  1825. Private Sub SaveCollect()
  1826.     Dim strWorkNo As String
  1827.     Dim strKqDate As String
  1828.     Dim strKqTime As String
  1829.     
  1830.     With msfGrid
  1831.         strWorkNo = Trim(.TextMatrix(mRowBeforeSave, mGridWorkNo))
  1832.         strKqDate = Trim(.TextMatrix(mRowBeforeSave, mGridStartDate))
  1833.         strKqTime = Trim(.TextMatrix(mRowBeforeSave, mGridStartTime))
  1834.     
  1835.         If strKqDate = Empty Then
  1836.             MsgBox "考勤日期不能为空,请输入!!", vbInformation, gTitle
  1837.             .col = mGridStartDate
  1838.             SetMedPosition msfGrid, medDate, True
  1839.             Exit Sub
  1840.         End If
  1841.         
  1842.         If strKqTime = Empty Then
  1843.             MsgBox "考勤时间不能为空,请输入!!", vbInformation, gTitle
  1844.             .col = mGridStartTime
  1845.             SetMedPosition msfGrid, medTime, False
  1846.             Exit Sub
  1847.         End If
  1848.         
  1849.         On Error GoTo SaveErr
  1850.         Dim Sql As String
  1851.         Sql = "Insert into KqHistory (WorkNo,KqDate,KqTime,OperateTime) values('" _
  1852.             & strWorkNo & "','" & strKqDate & "','" _
  1853.             & strKqTime & "','" & Format(Date, "yyyy-mm-dd") & "')"
  1854.         gDataBase.Execute Sql
  1855.         msfGrid.Enabled = True
  1856.         cmdKq(gCMDAPPEND).Enabled = True
  1857.         cmdKq(gCMDSAVE).Enabled = False
  1858.     End With
  1859.     Exit Sub
  1860. SaveErr:
  1861.     MsgBox "保存未成功" & vbCrLf & Err.Description, vbExclamation, gTitle
  1862.     Err.Clear
  1863. End Sub
  1864. Private Sub medTime_LostFocus()
  1865.     medTime.Visible = False
  1866. End Sub
  1867. Private Sub mnuEditDelete_Click()
  1868.     cmdEdit_Click gCMDDELETE
  1869. End Sub
  1870. Private Sub mnuEditModify_Click()
  1871.     cmdEdit_Click gCMDEDIT
  1872. End Sub
  1873. Private Sub msfGrid_DblClick()
  1874.     If mStatus = gMAINCOLLECT Then
  1875.         With msfGrid
  1876.             Select Case .col
  1877.                 Case mGridStartDate, mGridStartTime
  1878.                     mblnCollectModify = True
  1879.                     mOldKqDate = Trim(.TextMatrix(.row, mGridStartDate))
  1880.                     mOldKqTime = Trim(.TextMatrix(.row, mGridStartTime))
  1881.                     If .col = mGridStartDate Then
  1882.                         .col = mGridStartDate
  1883.                         SetMedPosition msfGrid, medDate, True
  1884.                         With medDate
  1885.                             .Mask = ""
  1886.                             .Text = mOldKqDate
  1887.                             .Mask = mDATEMASK
  1888.                         End With
  1889.                     Else
  1890.                         .col = mGridStartTime
  1891.                         SetMedPosition msfGrid, medTime, False
  1892.                         With medTime
  1893.                             .Mask = ""
  1894.                             .Text = mOldKqTime
  1895.                             .Mask = mTIMEMASK
  1896.                         End With
  1897.                     End If
  1898.             End Select
  1899.         End With
  1900.     End If
  1901. End Sub
  1902. Private Sub msfGrid_GotFocus()
  1903.     If msfGrid.Rows <= msfGrid.FixedRows Then Exit Sub
  1904.     If mStatus = gMAINCOLLECT Then
  1905.         cmdKq(gCMDEDIT).Enabled = True
  1906.         cmdKq(gCMDDELETE).Enabled = True
  1907.     Else
  1908.         If Not (mblnIsModify Or mblnIsAdd) Then
  1909.             RefreshBtnLocal True
  1910.         End If
  1911.     End If
  1912. End Sub
  1913. Private Sub RefreshBtnLocal(blnIsGotFocus As Boolean)
  1914.     cmdEdit(gCMDEDIT).Enabled = blnIsGotFocus
  1915.     cmdEdit(gCMDDELETE).Enabled = blnIsGotFocus
  1916. End Sub
  1917. 'Private Sub mnuPosDateSet_Click()
  1918. '    frmSetDate.Show 1
  1919. 'End Sub
  1920. 'Private Sub mnuQueryFlow_Click()
  1921. '    frmFlow.Show 0, Me
  1922. 'End Sub
  1923. Private Sub msfGrid_KeyDown(KeyCode As Integer, Shift As Integer)
  1924.     If KeyCode = 13 Then
  1925.         If mStatus = gMAINCOLLECT Then
  1926.             msfGrid_DblClick
  1927.         End If
  1928.     End If
  1929. End Sub
  1930. 'Private Sub Timer1_Timer()
  1931. '    sbrData.Panels(4).Text = "时间:" & Format(Now, "hh:mm:ss")
  1932. 'End Sub
  1933. Private Sub iniTitle()
  1934.     Dim strTemp As String
  1935.     Select Case mMenuIndex
  1936.         Case gMAINCOLLECT
  1937.             strTemp = "^工  号" & Space(3) & vbTab _
  1938.                    & "<姓  名" & Space(5) & vbTab _
  1939.                    & "^性  别" & Space(5) & vbTab _
  1940.                    & "<部  门" & Space(7) & vbTab _
  1941.                    & "<职  务" & Space(7) & vbTab _
  1942.                    & "^考 勤 日 期" & Space(11) & vbTab _
  1943.                    & "^考 勤 时 间" & Space(11) '7
  1944.         Case gMAINLEAVE
  1945.             strTemp = "^工 号" & Space(0) & vbTab _
  1946.                    & "<姓 名" & Space(2) & vbTab _
  1947.                    & "^性 别" & Space(0) & vbTab _
  1948.                    & "<部 门" & Space(1) & vbTab _
  1949.                    & "<职 务" & Space(1) & vbTab _
  1950.                    & "^起始日期" & Space(3) & vbTab _
  1951.                    & "^起始时间" & Space(1) & vbTab _
  1952.                    & "^截止日期" & Space(3) & vbTab _
  1953.                    & "^截止时间" & Space(1) & vbTab _
  1954.                    & "<请假类型" & Space(0) & vbTab _
  1955.                    & "<批准人" & Space(2) & vbTab _
  1956.                    & "<事  由" & Space(5) '12
  1957.         Case gMAINABSENT
  1958.              strTemp = "^工 号" & Space(1) & vbTab _
  1959.                    & "<姓 名" & Space(2) & vbTab _
  1960.                    & "^性 别" & Space(1) & vbTab _
  1961.                    & "<部 门" & Space(2) & vbTab _
  1962.                    & "<职 务" & Space(2) & vbTab _
  1963.                    & "^起始日期" & Space(4) & vbTab _
  1964.                    & "^起始时间" & Space(3) & vbTab _
  1965.                    & "^截止日期" & Space(4) & vbTab _
  1966.                    & "^截止时间" & Space(3) & vbTab _
  1967.                    & "<缺席类型" & Space(2) & vbTab _
  1968.                    & "<批准人" & Space(2) '11
  1969.     End Select
  1970.     mFormatString = strTemp
  1971. End Sub
  1972. Private Sub msfGrid_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  1973.     With msfGrid
  1974.         If .MouseRow = 0 Then Exit Sub
  1975.         If .Rows <= .FixedRows Then Exit Sub
  1976.         If Button = 2 Then
  1977.             If Trim(.TextMatrix(.MouseRow, mGridWorkNo)) <> Empty Then
  1978.                 PopupMenu mnuEdit
  1979.             End If
  1980.         End If
  1981.     End With
  1982. End Sub
  1983. Private Sub txtEdit_GotFocus()
  1984.     msfGrid.Enabled = False
  1985.     mRowBeforeSave = msfGrid.row
  1986.     GotFocus txtEdit
  1987. End Sub
  1988. Private Sub txtEdit_KeyDown(KeyCode As Integer, Shift As Integer)
  1989.     Select Case KeyCode
  1990.         Case 13
  1991.             Dim Str As String
  1992.             Dim strName As String
  1993.             Dim strSex As String
  1994.             Dim strDept As String
  1995.             Dim strTitle As String
  1996.             Dim Sql As String
  1997.             Dim Rst As Recordset
  1998.             Str = Trim(txtEdit)
  1999.             Sql = " select * from QryEmployee where WorkNo='" & Str & "'" _
  2000.                 & " order by WorkNo"
  2001.             Set Rst = gDataBase.OpenRecordset(Sql, dbOpenSnapshot)
  2002.             If Rst.RecordCount > 0 Then
  2003.                 strName = IIf(IsNull(Rst!Name), "", Trim(Rst!Name))
  2004.                 strSex = IIf(IsNull(Rst!Sex), "", Trim(Rst!Sex))
  2005.                 strDept = IIf(IsNull(Rst!DeptName), "", Trim(Rst!DeptName))
  2006.                 strTitle = IIf(IsNull(Rst!TitleName), "", Trim(Rst!TitleName))
  2007.                 txtEdit.Visible = False
  2008.                 With msfGrid
  2009.                     .TextMatrix(.row, mGridWorkNo) = Str
  2010.                     .TextMatrix(.row, mGridName) = strName
  2011.                     .TextMatrix(.row, mGridSex) = strSex
  2012.                     .TextMatrix(.row, mGridDept) = strDept
  2013.                     .TextMatrix(.row, mGridTitle) = strTitle
  2014.                     
  2015.                     .col = mGridStartDate
  2016.                 End With
  2017.                 SetMedPosition msfGrid, medDate, True
  2018.             End If
  2019.         Case 27
  2020.             txtEdit_LostFocus
  2021.     End Select
  2022. End Sub
  2023. Private Sub SetMedPosition(tmpGrid As MSFlexGrid, tmpMed As MaskEdBox, Optional isDate As Boolean = True)
  2024.     With tmpGrid
  2025.         tmpMed.Top = .Top + .CellTop
  2026.         tmpMed.Left = .Left + .CellLeft
  2027.         tmpMed.Width = .CellWidth
  2028.         tmpMed.Height = .CellHeight
  2029.         tmpMed.Mask = ""
  2030.         'tmpMed.Text = ""
  2031.         If isDate Then
  2032.             tmpMed.Text = Format(Date, "yyyy-mm-dd")
  2033.             tmpMed.Mask = mDATEMASK
  2034.         Else
  2035.             tmpMed.Text = "08:00"
  2036.             tmpMed.Mask = mTIMEMASK
  2037.         End If
  2038.         tmpMed.Visible = True
  2039.         tmpMed.SetFocus
  2040.     End With
  2041. End Sub
  2042. Private Sub txtEdit_LostFocus()
  2043.     txtEdit.Visible = False
  2044.     ValidAction msfGrid, txtEdit
  2045. End Sub
  2046. Private Sub ValidAction(tmpGrid As MSFlexGrid, tmpTxt As TextBox)
  2047.     With tmpGrid
  2048.         If Trim(.TextMatrix(.row, mGridWorkNo)) = Empty Then
  2049.              .Rows = .Rows - 1
  2050.              cmdKq(gCMDAPPEND).Enabled = True
  2051.              cmdKq(gCMDSAVE).Enabled = False
  2052.              msfGrid.Enabled = True
  2053.         End If
  2054.     End With
  2055. End Sub
  2056. Private Sub UpDownCheck(KeyCode As Integer, msfGrid As MSFlexGrid)
  2057.     Dim sRow, SCol As Integer
  2058.     
  2059.     With msfGrid
  2060.         If KeyCode = vbKeyDown Then
  2061.             sRow = .row + 1
  2062.             If sRow = .Rows Then
  2063.                 sRow = .FixedRows
  2064.             End If
  2065.         ElseIf KeyCode = vbKeyUp Then
  2066.             sRow = .row - 1
  2067.             If sRow = 0 Then
  2068.                 sRow = .Rows - 1
  2069.             End If
  2070.         ElseIf KeyCode = 13 Then
  2071.             sRow = .row
  2072.         End If
  2073.         SCol = .ColSel
  2074.     
  2075.         .row = sRow
  2076.         .col = SCol
  2077.         .RowSel = sRow
  2078.     End With
  2079. End Sub
  2080. Private Sub FillGridByRst(myGrid As MSFlexGrid, CurRow As Integer, Rst As Recordset)
  2081.     With myGrid
  2082.         .TextMatrix(CurRow, 1) = IIf(IsNull(Rst!Name), "", Trim(Rst!Name))
  2083.         .TextMatrix(CurRow, 2) = IIf(IsNull(Rst!Sex), "", Trim(Rst!Sex))
  2084.         '.TextMatrix(CurRow, 3) = IIf(IsNull(Rst!Age), "", Trim(Rst!Age))
  2085.         .TextMatrix(CurRow, 3) = IIf(IsNull(Rst!Department), "", Trim(Rst!Deptment))
  2086.         .TextMatrix(CurRow, 4) = IIf(IsNull(Rst!Title), "", Trim(Rst!Title))
  2087.     End With
  2088. End Sub
  2089. Private Sub txtKQ_Change(Index As Integer)
  2090.     If Index = mtxtWorkNo Then
  2091.         If Not txtKQ(Index).Locked Then
  2092.             mblnIsNeedSave = Trim(txtKQ(Index)) <> Empty
  2093.         End If
  2094.     End If
  2095. End Sub
  2096. Private Sub txtKQ_DblClick(Index As Integer)
  2097. '    If Not mdblClickIsValid Then Exit Sub
  2098.     Select Case Index
  2099.         Case mtxtWorkNo, mtxtSDate, mtxtEDate
  2100.             txtKQ_KeyDown Index, 13, vbCtrlMask
  2101.     End Select
  2102. End Sub
  2103. Private Sub txtKQ_GotFocus(Index As Integer)
  2104.     GotFocus txtKQ(Index)
  2105. End Sub
  2106. Private Sub txtKQ_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
  2107.        
  2108.     If KeyCode = 13 Then
  2109.         Select Case Index
  2110.             Case mtxtWorkNo, mtxtSDate, mtxtEDate
  2111.                 Dim CtrlDown As Boolean
  2112.                 CtrlDown = (vbCtrlMask And Shift) > 0
  2113.                 If CtrlDown Then
  2114.                     Select Case Index
  2115.                         Case mtxtWorkNo
  2116.                             'frmLookMan.Tag = UCase("frmMain")
  2117.                             With frmLookMan
  2118.                                 .Show vbModal
  2119.                                 txtKQ(mtxtWorkNo) = .mWorkNo
  2120.                                 txtKQ(mtxtName) = .mName
  2121.                                 txtKQ(mtxtSex) = .mSex
  2122.                                 txtKQ(mtxtAge) = .mAge
  2123.                                 txtKQ(mtxtDept) = .mDept
  2124.                                 txtKQ(mtxtTitle) = .mTitle
  2125.                             End With
  2126.                         Case mtxtSDate, mtxtEDate
  2127.                             'mRetDate = Empty
  2128.                             'frmRiLi.Tag = UCase("frmMain")
  2129.                             frmRiLi.Show vbModal
  2130.                             If frmRiLi.mRetDate <> Empty Then
  2131.                                 txtKQ(Index) = frmRiLi.mRetDate
  2132.                             End If
  2133.                     End Select
  2134.                 Else
  2135.                     SendKeyTab KeyCode
  2136.                 End If
  2137. '            Case mtxtSHour, mtxtEHour
  2138.                 
  2139.             Case Else
  2140.                 SendKeyTab KeyCode
  2141.         End Select
  2142.     End If
  2143. End Sub
  2144. Private Sub txtKQ_LostFocus(Index As Integer)
  2145.     Select Case Index
  2146.         Case mtxtWorkNo
  2147.             If Trim(txtKQ(mtxtWorkNo)) = Empty Then Exit Sub
  2148.             If Trim(txtKQ(mtxtName)) <> Empty Then Exit Sub
  2149.             Dim tmpStr As String
  2150.             Dim Rst As Recordset
  2151.             tmpStr = Trim(txtKQ(Index))
  2152.             Set Rst = gDataBase.OpenRecordset("select * from QryEmployee" _
  2153.                 & " Where WorkNo='" & tmpStr & "'", dbOpenSnapshot)
  2154.             If Rst.RecordCount > 0 Then
  2155.                 With Rst
  2156.                 txtKQ(mtxtName) = IIf(IsNull(!Name), "", Trim(!Name))
  2157.                 txtKQ(mtxtSex) = IIf(IsNull(!Sex), "", Trim(!Sex))
  2158.                 txtKQ(mtxtAge) = IIf(IsNull(!Age), "", Trim(!Age))
  2159.                 txtKQ(mtxtDept) = IIf(IsNull(!DeptName), "", Trim(!DeptName))
  2160.                 txtKQ(mtxtTitle) = IIf(IsNull(!TitleName), "", Trim(!TitleName))
  2161.                 End With
  2162.             Else
  2163.                 If Me.Enabled Then
  2164.                     MsgBox "无此工号!请重输!!", , gTitle
  2165.                     txtKQ(mtxtWorkNo).SetFocus
  2166.                 End If
  2167.             End If
  2168.             Rst.Close
  2169.             Set Rst = Nothing
  2170.             'End If
  2171.     End Select
  2172. End Sub
  2173. Private Sub InitxtEdit()
  2174.     Dim i As Integer
  2175.     For i = 0 To txtKQ.Count - 1
  2176.         With txtKQ(i)
  2177.             Select Case i
  2178.                 Case mtxtSDate, mtxtEDate
  2179.                     .Text = getToday
  2180.                 Case mtxtSHour
  2181.                     .Text = mstrSHour
  2182.                 Case mtxtEHour
  2183.                     .Text = mstrEHour
  2184.                 Case mtxtSMinute, mtxtEMinute
  2185.                     .Text = mstrMinute
  2186.                 Case Else
  2187.                     .Text = Empty
  2188.             End Select
  2189.         End With
  2190.     Next
  2191.     If cboKQ.ListCount > 0 Then cboKQ.ListIndex = 0
  2192. End Sub
  2193. Private Function CollectDataFromPos() As Boolean
  2194.     Dim blnIsOpen As Boolean
  2195.     Dim blnIsTras As Boolean
  2196.     'Dim strIn As String
  2197.     Dim nRecCount As Integer
  2198.     'Dim Rst As Recordset
  2199.     Dim nRet As Integer
  2200.     Dim j As Integer
  2201.     Dim i As Integer
  2202.     Dim blnProgIsShow As Boolean
  2203.     'Set Rst = gDataBase.OpenRecordset("KqHistory")
  2204.     
  2205.     If OpenComm(gCommPort) <> 0 Then
  2206.         MsgBox mstrOpenCommErr, vbInformation, gTitle
  2207.         GoTo CollectErr
  2208.     End If
  2209.     blnIsOpen = True
  2210.     
  2211.     nRecCount = POS_IsReady(gPosNumber)
  2212.     If nRecCount < 0 Then
  2213.         MsgBox mMsg1, vbInformation + vbOKOnly, gTitle
  2214.         GoTo CollectErr
  2215.     End If
  2216.     
  2217.     Dim strFrame As String * 20
  2218.     Dim blnIsAdd As Boolean
  2219.     Dim strWorkNo As String
  2220.     Dim strDate As String
  2221.     Dim strTime As String
  2222.     'Dim EmpRst As String
  2223.     
  2224.     On Error GoTo CollectErr
  2225.     ReDim mKqRecord(0)
  2226.     mKqRecord(0).WorkNo = ""
  2227.     
  2228.     'Set Rst = gDataBase.OpenRecordset("KqTemp")
  2229.     
  2230. '    Set EmpRst = gDataBase.OpenRecordset("select * from " _
  2231. '        & " QryEmployee order by WorkNo", dbOpenSnapshot)
  2232.     If nRecCount = 0 Then
  2233.         If blnIsOpen Then CloseComm
  2234.         MsgBox mMsg4, vbInformation, gTitle
  2235.         CollectDataFromPos = False
  2236.         Exit Function
  2237.     End If
  2238.     
  2239.     ReDim Preserve mKqRecord(nRecCount)
  2240.     
  2241.     Screen.MousePointer = 11
  2242.     frmMain.Enabled = False
  2243.     With frmProg
  2244.         .Label1.Caption = "正在采集[" & mPosName _
  2245.             & "]的数据,请稍候..."
  2246.         .Show
  2247.         .Refresh
  2248.     End With
  2249.     blnProgIsShow = True
  2250.     
  2251.     frmProg.ProgressBar1.Min = 0
  2252.     If nRecCount > 0 Then
  2253.         frmProg.ProgressBar1.Max = nRecCount + 1
  2254.     Else
  2255.         frmProg.ProgressBar1.Max = 100
  2256.     End If
  2257.     
  2258.     BeginTrans
  2259.     blnIsTras = True
  2260.     For i = 1 To nRecCount + 1
  2261.         blnIsAdd = False
  2262.         nRet = POS_GetNextFrame(gPosNumber, strFrame)
  2263.         frmProg.ProgressBar1.Value = i
  2264.         Select Case nRet
  2265.             Case 0
  2266.                 blnIsAdd = True
  2267.             Case 1
  2268.                 blnIsAdd = False
  2269.                 Exit For
  2270.             Case Else
  2271.                 For j = 1 To mRetryTimes
  2272.                     nRet = POS_GetFrameAgain(1, strFrame)
  2273.                     If nRet = 0 Then
  2274.                         blnIsAdd = True
  2275.                         Exit For
  2276.                     End If
  2277.                 Next
  2278.                 If Not blnIsAdd Then
  2279.                     MsgBox mMsg2, vbExclamation + vbOKOnly, gTitle
  2280.                     GoTo CollectErr
  2281.                 End If
  2282.         End Select
  2283.         If blnIsAdd Then
  2284.             If Trim(strFrame) <> Empty Then
  2285.                 strWorkNo = Chr(Val(Mid(strFrame, 1, 1)) * 16 _
  2286.                     + Val(Mid(strFrame, 2, 1))) & _
  2287.                     Chr(Val(Mid(strFrame, 3, 1)) * 16 _
  2288.                     + Val(Mid(strFrame, 4, 1))) & _
  2289.                     Chr(Val(Mid(strFrame, 5, 1)) * 16 _
  2290.                     + Val(Mid(strFrame, 6, 1))) & _
  2291.                     Chr(Val(Mid(strFrame, 7, 1)) * 16 _
  2292.                     + Val(Mid(strFrame, 8, 1)))
  2293.                 strDate = "20" & Mid(strFrame, 9, 2) & "-" & _
  2294.                     Mid(strFrame, 11, 2) & "-" & _
  2295.                     Mid(strFrame, 13, 2)
  2296.                 strTime = Mid(strFrame, 15, 2) & ":" & _
  2297.                         Mid(strFrame, 17, 2) & ":" & _
  2298.                         Mid(strFrame, 19, 2)
  2299.                 'strIn = strIn & strWorkNo
  2300. '                Rst.AddNew
  2301. '                Rst!WorkNo = Trim(strWorkNo)
  2302. '                Rst!KqDate = Trim(strDate)
  2303. '                Rst!KqTime = Trim(strTime)
  2304. '                Rst.Update
  2305.                 With mKqRecord(i)
  2306.                     .WorkNo = Trim(strWorkNo)
  2307.                     .KqDate = Trim(strDate)
  2308.                     .KqTime = Trim(strTime)
  2309.                 End With
  2310.             Else
  2311.                 MsgBox mMsg3, vbExclamation, gTitle
  2312.                 GoTo CollectErr
  2313.             End If
  2314.         End If
  2315.     Next
  2316.     
  2317.     CommitTrans
  2318.     CloseComm
  2319.     
  2320.     If Not Me.Enabled Then Me.Enabled = True
  2321.     Screen.MousePointer = 99
  2322.     Unload frmProg
  2323.     MsgBox mMsg5, vbInformation, gTitle
  2324.     
  2325.     CollectDataFromPos = True
  2326.     Exit Function
  2327.     
  2328. CollectErr:
  2329.     If blnProgIsShow Then
  2330.         If Not Me.Enabled Then Me.Enabled = True
  2331.         Screen.MousePointer = 99
  2332.         If Not frmProg Is Nothing Then Unload frmProg
  2333.     End If
  2334.     
  2335.     If blnIsOpen Then
  2336.         CloseComm
  2337.     End If
  2338.     If blnIsTras Then
  2339.         Rollback
  2340.     End If
  2341.     CollectDataFromPos = False
  2342.     Exit Function
  2343. End Function
  2344. Private Sub WriteTempToKq()
  2345.     If UBound(mKqRecord) < 1 Then Exit Sub
  2346.     Dim i As Integer
  2347.     Dim strWorkNo As String
  2348.     Dim strKqDate As String
  2349.     Dim strKqTime As String
  2350.     Dim intCardStatus As Integer
  2351.     Dim strIn As String
  2352.     Dim Rst As Recordset
  2353.     Dim EmpRst As Recordset
  2354.     
  2355.     'Set mColNotRegister = New Collection
  2356.     'Set mColInValidCard = New Collection
  2357.     ReDim mColNotRegister(0)
  2358.     mColNotRegister(0).WorkNo = ""
  2359.     ReDim mColInValidCard(0)
  2360.     mColInValidCard(0).WorkNo = ""
  2361.     
  2362.     Set Rst = gDataBase.OpenRecordset("KqHistory")
  2363.     Set EmpRst = gDataBase.OpenRecordset("Select * from " _
  2364.         & " QryEmployee order by WorkNo", dbOpenSnapshot)
  2365.     
  2366. '    On Error GoTo WriteErr
  2367. '    Dim blnIsTrans As Boolean
  2368. '    BeginTrans
  2369. '    blnIsTrans = True
  2370.     Dim intRows As Integer
  2371.     Dim intCols As Integer
  2372.     
  2373.     For i = 1 To UBound(mKqRecord)
  2374.         With mKqRecord(i)
  2375.             strWorkNo = Trim(.WorkNo)
  2376.             strKqDate = Trim(.KqDate)
  2377.             strKqTime = Trim(.KqTime)
  2378.         End With
  2379.         EmpRst.FindFirst "WorkNo='" & strWorkNo & "'"
  2380.         If EmpRst.NoMatch Then '卡未登记
  2381.             ReDim Preserve mColNotRegister(UBound(mColNotRegister) + 1)
  2382.             With mColNotRegister(UBound(mColNotRegister))
  2383.                 .WorkNo = strWorkNo
  2384.                 .KqDate = strKqDate
  2385.                 .KqTime = strKqTime
  2386.             End With
  2387.         Else
  2388.             If EmpRst!CardStatus <> gHasCard Then '非法卡在流通
  2389.                 ReDim Preserve mColInValidCard(UBound(mColInValidCard) + 1)
  2390.                 With mColInValidCard(UBound(mColInValidCard))
  2391.                     .WorkNo = strWorkNo
  2392.                     .KqDate = strKqDate
  2393.                     .KqTime = strKqTime
  2394.                 End With
  2395.             Else
  2396.                 Rst.AddNew
  2397.                 Rst!WorkNo = strWorkNo
  2398.                 Rst!KqDate = strKqDate
  2399.                 Rst!KqTime = strKqTime
  2400.                 Rst!OperateTime = Format(Date, "yyyy-mm-dd")
  2401.                 Rst.Update
  2402.                 intRows = intRows + 1
  2403.                 With EmpRst
  2404.                     strIn = strIn & strWorkNo & vbTab _
  2405.                         & !Name & vbTab & !Sex & vbTab _
  2406.                         & !DeptName & vbTab & !TitleName & vbTab _
  2407.                         & strKqDate & vbTab & strKqTime
  2408.                     If i <> UBound(mKqRecord) Then strIn = strIn & vbCr
  2409.                 End With
  2410.             End If
  2411.         End If
  2412.     Next
  2413.     EmpRst.Close
  2414.     Set EmpRst = Nothing
  2415.     Rst.Close
  2416.     Set Rst = Nothing
  2417.     
  2418.     If UBound(mColNotRegister) > 0 Or UBound(mColInValidCard) > 0 Then
  2419.         msfGrid.Top = mHasInValidTop
  2420.         msfGrid.Height = mHasInValidHeight
  2421.         If Not fraList.Visible Then
  2422.             fraList.Visible = True
  2423.             Dim j As Integer
  2424.             lstNotRegister.Clear
  2425.             lstInValidCard.Clear
  2426.             If UBound(mColNotRegister) > 0 Then
  2427.                 For j = 1 To UBound(mColNotRegister)
  2428.                     With mColNotRegister(j)
  2429.                         lstNotRegister.AddItem FixedLen(.WorkNo, 12, 0) & _
  2430.                             FixedLen(.KqDate, 20, 0) & FixedLen(.KqTime, 16, 0)
  2431.                     End With
  2432.                 Next
  2433.             End If
  2434.             If UBound(mColInValidCard) > 0 Then
  2435.                 For j = 1 To UBound(mColInValidCard)
  2436.                     With mColInValidCard(j)
  2437.                         lstInValidCard.AddItem FixedLen(.WorkNo, 12, 0) & _
  2438.                             FixedLen(.KqDate, 20, 0) & FixedLen(.KqTime, 16, 0)
  2439.                     End With
  2440.                 Next
  2441.             End If
  2442.             lblNotRegister = UBound(mColNotRegister)
  2443.             lblInvalidCard = UBound(mColInValidCard)
  2444.         End If
  2445.     Else
  2446.         If fraList.Visible Then
  2447.             fraList.Visible = False
  2448.             msfGrid.Top = mValidTop
  2449.             msfGrid.Height = mValidHeight
  2450.         End If
  2451.     End If
  2452.     
  2453.     intCols = mIntCollectCols
  2454.     ClipToGrid msfGrid, strIn, intRows + 1, intCols
  2455.     'Exit Sub
  2456. 'WriteErr:
  2457. '    If blnIsTrans Then
  2458. '        Rollback
  2459. '    End If
  2460. End Sub