main_rsgl_htgl.frm
上传用户:ake0106
上传日期:2022-07-23
资源大小:4052k
文件大小:23k
源码类别:

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
  4. Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
  5. Begin VB.Form main_rsgl_htgl 
  6.    BorderStyle     =   3  'Fixed Dialog
  7.    Caption         =   "Form1"
  8.    ClientHeight    =   5160
  9.    ClientLeft      =   45
  10.    ClientTop       =   330
  11.    ClientWidth     =   11205
  12.    Icon            =   "main_rsgl_htgl.frx":0000
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   5160
  17.    ScaleWidth      =   11205
  18.    ShowInTaskbar   =   0   'False
  19.    StartUpPosition =   2  '屏幕中心
  20.    Begin MSAdodcLib.Adodc Adodc1 
  21.       Height          =   330
  22.       Left            =   60
  23.       Top             =   2040
  24.       Visible         =   0   'False
  25.       Width           =   2040
  26.       _ExtentX        =   3598
  27.       _ExtentY        =   582
  28.       ConnectMode     =   0
  29.       CursorLocation  =   3
  30.       IsolationLevel  =   -1
  31.       ConnectionTimeout=   15
  32.       CommandTimeout  =   30
  33.       CursorType      =   3
  34.       LockType        =   3
  35.       CommandType     =   2
  36.       CursorOptions   =   0
  37.       CacheSize       =   50
  38.       MaxRecords      =   0
  39.       BOFAction       =   0
  40.       EOFAction       =   0
  41.       ConnectStringType=   1
  42.       Appearance      =   1
  43.       BackColor       =   -2147483643
  44.       ForeColor       =   -2147483640
  45.       Orientation     =   0
  46.       Enabled         =   -1
  47.       Connect         =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_manpowerinfo"
  48.       OLEDBString     =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_manpowerinfo"
  49.       OLEDBFile       =   ""
  50.       DataSourceName  =   ""
  51.       OtherAttributes =   ""
  52.       UserName        =   ""
  53.       Password        =   ""
  54.       RecordSource    =   "合同表"
  55.       Caption         =   "Adodc1"
  56.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  57.          Name            =   "宋体"
  58.          Size            =   9
  59.          Charset         =   134
  60.          Weight          =   400
  61.          Underline       =   0   'False
  62.          Italic          =   0   'False
  63.          Strikethrough   =   0   'False
  64.       EndProperty
  65.       _Version        =   393216
  66.    End
  67.    Begin MSComctlLib.ImageList ImageList1 
  68.       Left            =   1875
  69.       Top             =   2730
  70.       _ExtentX        =   1005
  71.       _ExtentY        =   1005
  72.       BackColor       =   -2147483643
  73.       ImageWidth      =   32
  74.       ImageHeight     =   32
  75.       MaskColor       =   12632256
  76.       _Version        =   393216
  77.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  78.          NumListImages   =   13
  79.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  80.             Picture         =   "main_rsgl_htgl.frx":000C
  81.             Key             =   ""
  82.          EndProperty
  83.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  84.             Picture         =   "main_rsgl_htgl.frx":0786
  85.             Key             =   ""
  86.          EndProperty
  87.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  88.             Picture         =   "main_rsgl_htgl.frx":1460
  89.             Key             =   ""
  90.          EndProperty
  91.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  92.             Picture         =   "main_rsgl_htgl.frx":1D3A
  93.             Key             =   ""
  94.          EndProperty
  95.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  96.             Picture         =   "main_rsgl_htgl.frx":2614
  97.             Key             =   ""
  98.          EndProperty
  99.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  100.             Picture         =   "main_rsgl_htgl.frx":2EEE
  101.             Key             =   ""
  102.          EndProperty
  103.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  104.             Picture         =   "main_rsgl_htgl.frx":3BC8
  105.             Key             =   ""
  106.          EndProperty
  107.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  108.             Picture         =   "main_rsgl_htgl.frx":44A2
  109.             Key             =   ""
  110.          EndProperty
  111.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  112.             Picture         =   "main_rsgl_htgl.frx":4D7C
  113.             Key             =   ""
  114.          EndProperty
  115.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  116.             Picture         =   "main_rsgl_htgl.frx":5656
  117.             Key             =   ""
  118.          EndProperty
  119.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  120.             Picture         =   "main_rsgl_htgl.frx":5F30
  121.             Key             =   ""
  122.          EndProperty
  123.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  124.             Picture         =   "main_rsgl_htgl.frx":6C0A
  125.             Key             =   ""
  126.          EndProperty
  127.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  128.             Picture         =   "main_rsgl_htgl.frx":7604
  129.             Key             =   ""
  130.          EndProperty
  131.       EndProperty
  132.    End
  133.    Begin MSComctlLib.Toolbar Toolbar1 
  134.       Align           =   1  'Align Top
  135.       Height          =   795
  136.       Left            =   0
  137.       TabIndex        =   0
  138.       Top             =   0
  139.       Width           =   11205
  140.       _ExtentX        =   19764
  141.       _ExtentY        =   1402
  142.       ButtonWidth     =   1455
  143.       ButtonHeight    =   1349
  144.       Appearance      =   1
  145.       Style           =   1
  146.       ImageList       =   "ImageList1"
  147.       _Version        =   393216
  148.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  149.          NumButtons      =   17
  150.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  151.             Caption         =   "查找"
  152.             Key             =   "find"
  153.             ImageIndex      =   1
  154.          EndProperty
  155.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  156.             Caption         =   "全部"
  157.             Key             =   "all"
  158.             ImageIndex      =   2
  159.          EndProperty
  160.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  161.             Style           =   3
  162.          EndProperty
  163.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  164.             Caption         =   "增加"
  165.             Key             =   "add"
  166.             ImageIndex      =   3
  167.          EndProperty
  168.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  169.             Caption         =   "修改"
  170.             Key             =   "modify"
  171.             ImageIndex      =   4
  172.          EndProperty
  173.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  174.             Caption         =   "删除"
  175.             Key             =   "delete"
  176.             ImageIndex      =   5
  177.          EndProperty
  178.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  179.             Style           =   3
  180.          EndProperty
  181.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  182.             Caption         =   "续约"
  183.             Key             =   "addpact"
  184.             ImageIndex      =   6
  185.          EndProperty
  186.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  187.             Caption         =   "生效"
  188.             Key             =   "takee"
  189.             ImageIndex      =   7
  190.          EndProperty
  191.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  192.             Caption         =   "解除"
  193.             Key             =   "undo"
  194.             ImageIndex      =   8
  195.          EndProperty
  196.          BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  197.             Caption         =   "试用"
  198.             Key             =   "test"
  199.             ImageIndex      =   9
  200.          EndProperty
  201.          BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  202.             Caption         =   "转正"
  203.             Key             =   "change"
  204.             ImageIndex      =   10
  205.          EndProperty
  206.          BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  207.             Caption         =   "到期处理"
  208.             Key             =   "atterm"
  209.             ImageIndex      =   11
  210.          EndProperty
  211.          BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  212.             Style           =   3
  213.          EndProperty
  214.          BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  215.             Caption         =   "Excel"
  216.             Key             =   "excel"
  217.             ImageIndex      =   12
  218.          EndProperty
  219.          BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  220.             Style           =   3
  221.          EndProperty
  222.          BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  223.             Caption         =   "关闭"
  224.             Key             =   "close"
  225.             ImageIndex      =   13
  226.          EndProperty
  227.       EndProperty
  228.       BorderStyle     =   1
  229.    End
  230.    Begin MSDataGridLib.DataGrid DataGrid1 
  231.       Bindings        =   "main_rsgl_htgl.frx":7EDE
  232.       Height          =   4290
  233.       Left            =   15
  234.       TabIndex        =   1
  235.       Top             =   825
  236.       Width           =   11145
  237.       _ExtentX        =   19659
  238.       _ExtentY        =   7567
  239.       _Version        =   393216
  240.       AllowUpdate     =   0   'False
  241.       HeadLines       =   1
  242.       RowHeight       =   15
  243.       FormatLocked    =   -1  'True
  244.       BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  245.          Name            =   "宋体"
  246.          Size            =   9
  247.          Charset         =   134
  248.          Weight          =   400
  249.          Underline       =   0   'False
  250.          Italic          =   0   'False
  251.          Strikethrough   =   0   'False
  252.       EndProperty
  253.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  254.          Name            =   "宋体"
  255.          Size            =   9
  256.          Charset         =   134
  257.          Weight          =   400
  258.          Underline       =   0   'False
  259.          Italic          =   0   'False
  260.          Strikethrough   =   0   'False
  261.       EndProperty
  262.       ColumnCount     =   12
  263.       BeginProperty Column00 
  264.          DataField       =   "员工编号"
  265.          Caption         =   "员工编号"
  266.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  267.             Type            =   0
  268.             Format          =   ""
  269.             HaveTrueFalseNull=   0
  270.             FirstDayOfWeek  =   0
  271.             FirstWeekOfYear =   0
  272.             LCID            =   2052
  273.             SubFormatType   =   0
  274.          EndProperty
  275.       EndProperty
  276.       BeginProperty Column01 
  277.          DataField       =   "员工姓名"
  278.          Caption         =   "员工姓名"
  279.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  280.             Type            =   0
  281.             Format          =   ""
  282.             HaveTrueFalseNull=   0
  283.             FirstDayOfWeek  =   0
  284.             FirstWeekOfYear =   0
  285.             LCID            =   2052
  286.             SubFormatType   =   0
  287.          EndProperty
  288.       EndProperty
  289.       BeginProperty Column02 
  290.          DataField       =   "合同编号"
  291.          Caption         =   "合同编号"
  292.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  293.             Type            =   0
  294.             Format          =   ""
  295.             HaveTrueFalseNull=   0
  296.             FirstDayOfWeek  =   0
  297.             FirstWeekOfYear =   0
  298.             LCID            =   2052
  299.             SubFormatType   =   0
  300.          EndProperty
  301.       EndProperty
  302.       BeginProperty Column03 
  303.          DataField       =   "合同类型"
  304.          Caption         =   "合同类型"
  305.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  306.             Type            =   0
  307.             Format          =   ""
  308.             HaveTrueFalseNull=   0
  309.             FirstDayOfWeek  =   0
  310.             FirstWeekOfYear =   0
  311.             LCID            =   2052
  312.             SubFormatType   =   0
  313.          EndProperty
  314.       EndProperty
  315.       BeginProperty Column04 
  316.          DataField       =   "合同开始日期"
  317.          Caption         =   "合同开始日期"
  318.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  319.             Type            =   0
  320.             Format          =   ""
  321.             HaveTrueFalseNull=   0
  322.             FirstDayOfWeek  =   0
  323.             FirstWeekOfYear =   0
  324.             LCID            =   2052
  325.             SubFormatType   =   0
  326.          EndProperty
  327.       EndProperty
  328.       BeginProperty Column05 
  329.          DataField       =   "合同结束日期"
  330.          Caption         =   "合同结束日期"
  331.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  332.             Type            =   0
  333.             Format          =   ""
  334.             HaveTrueFalseNull=   0
  335.             FirstDayOfWeek  =   0
  336.             FirstWeekOfYear =   0
  337.             LCID            =   2052
  338.             SubFormatType   =   0
  339.          EndProperty
  340.       EndProperty
  341.       BeginProperty Column06 
  342.          DataField       =   "合同期限"
  343.          Caption         =   "合同期限"
  344.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  345.             Type            =   0
  346.             Format          =   ""
  347.             HaveTrueFalseNull=   0
  348.             FirstDayOfWeek  =   0
  349.             FirstWeekOfYear =   0
  350.             LCID            =   2052
  351.             SubFormatType   =   0
  352.          EndProperty
  353.       EndProperty
  354.       BeginProperty Column07 
  355.          DataField       =   "合同期工资"
  356.          Caption         =   "合同期工资"
  357.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  358.             Type            =   0
  359.             Format          =   ""
  360.             HaveTrueFalseNull=   0
  361.             FirstDayOfWeek  =   0
  362.             FirstWeekOfYear =   0
  363.             LCID            =   2052
  364.             SubFormatType   =   0
  365.          EndProperty
  366.       EndProperty
  367.       BeginProperty Column08 
  368.          DataField       =   "试用期"
  369.          Caption         =   "试用期"
  370.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  371.             Type            =   0
  372.             Format          =   ""
  373.             HaveTrueFalseNull=   0
  374.             FirstDayOfWeek  =   0
  375.             FirstWeekOfYear =   0
  376.             LCID            =   2052
  377.             SubFormatType   =   0
  378.          EndProperty
  379.       EndProperty
  380.       BeginProperty Column09 
  381.          DataField       =   "试用期工资"
  382.          Caption         =   "试用期工资"
  383.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  384.             Type            =   0
  385.             Format          =   ""
  386.             HaveTrueFalseNull=   0
  387.             FirstDayOfWeek  =   0
  388.             FirstWeekOfYear =   0
  389.             LCID            =   2052
  390.             SubFormatType   =   0
  391.          EndProperty
  392.       EndProperty
  393.       BeginProperty Column10 
  394.          DataField       =   "备注"
  395.          Caption         =   "备注"
  396.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  397.             Type            =   0
  398.             Format          =   ""
  399.             HaveTrueFalseNull=   0
  400.             FirstDayOfWeek  =   0
  401.             FirstWeekOfYear =   0
  402.             LCID            =   2052
  403.             SubFormatType   =   0
  404.          EndProperty
  405.       EndProperty
  406.       BeginProperty Column11 
  407.          DataField       =   "状态"
  408.          Caption         =   "状态"
  409.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  410.             Type            =   0
  411.             Format          =   ""
  412.             HaveTrueFalseNull=   0
  413.             FirstDayOfWeek  =   0
  414.             FirstWeekOfYear =   0
  415.             LCID            =   2052
  416.             SubFormatType   =   0
  417.          EndProperty
  418.       EndProperty
  419.       SplitCount      =   1
  420.       BeginProperty Split0 
  421.          MarqueeStyle    =   4
  422.          BeginProperty Column00 
  423.             ColumnWidth     =   915.024
  424.          EndProperty
  425.          BeginProperty Column01 
  426.             ColumnWidth     =   1365.165
  427.          EndProperty
  428.          BeginProperty Column02 
  429.             ColumnWidth     =   1814.74
  430.          EndProperty
  431.          BeginProperty Column03 
  432.             ColumnWidth     =   2085.166
  433.          EndProperty
  434.          BeginProperty Column04 
  435.             ColumnWidth     =   2085.166
  436.          EndProperty
  437.          BeginProperty Column05 
  438.             ColumnWidth     =   2085.166
  439.          EndProperty
  440.          BeginProperty Column06 
  441.             ColumnWidth     =   1365.165
  442.          EndProperty
  443.          BeginProperty Column07 
  444.             ColumnWidth     =   2085.166
  445.          EndProperty
  446.          BeginProperty Column08 
  447.             ColumnWidth     =   1365.165
  448.          EndProperty
  449.          BeginProperty Column09 
  450.             ColumnWidth     =   2085.166
  451.          EndProperty
  452.          BeginProperty Column10 
  453.             ColumnWidth     =   2085.166
  454.          EndProperty
  455.          BeginProperty Column11 
  456.             ColumnWidth     =   824.882
  457.          EndProperty
  458.       EndProperty
  459.    End
  460. End
  461. Attribute VB_Name = "main_rsgl_htgl"
  462. Attribute VB_GlobalNameSpace = False
  463. Attribute VB_Creatable = False
  464. Attribute VB_PredeclaredId = True
  465. Attribute VB_Exposed = False
  466. Dim rs1 As New ADODB.Recordset
  467. Dim i As Integer
  468. Private Sub SetButtons()
  469.   For i = 5 To 12
  470.    Toolbar1.Buttons(i).Enabled = True
  471.   Next i
  472. End Sub
  473. Private Sub DataGrid1_DblClick()
  474.   If Adodc1.Recordset.RecordCount > 0 Then
  475.     blnAddHT = False
  476.     Load main_rsgl_htgl_lr
  477.     main_rsgl_htgl_lr.Show 1
  478.   End If
  479. End Sub
  480. Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
  481.  With Adodc1.Recordset
  482.    If .RecordCount > 0 Then
  483.       On Error Resume Next
  484.       SetButtons
  485.       Select Case .Fields("状态")
  486.         Case "到期"
  487.           For i = 9 To 12
  488.             Toolbar1.Buttons(i).Enabled = False
  489.           Next i
  490.         Case "生效"
  491.           Toolbar1.Buttons(8).Enabled = False
  492.           Toolbar1.Buttons(9).Enabled = False
  493.           Toolbar1.Buttons(12).Enabled = False
  494.         Case "解除"
  495.           Toolbar1.Buttons(8).Enabled = False
  496.           Toolbar1.Buttons(10).Enabled = False
  497.         Case "试用"
  498.           Toolbar1.Buttons(8).Enabled = False
  499.           Toolbar1.Buttons(11).Enabled = False
  500.         End Select
  501.     End If
  502.   End With
  503. End Sub
  504. Private Sub Form_Activate()
  505.   If sql1 <> "" Then
  506.      Adodc1.RecordSource = sql1
  507.      Adodc1.Refresh
  508.      If Adodc1.Recordset.RecordCount > 0 Then
  509.      Else
  510.         MsgBox "没有找到符合条件的记录!", , "提示窗口"
  511.      End If
  512.   End If
  513. End Sub
  514. Private Sub Form_Load()
  515.   Me.Caption = text
  516.   DataGrid1_RowColChange 0, 0
  517.   Dim fld
  518.   For Each fld In Adodc1.Recordset.Fields
  519.      '如果字段类型为"货币",则格式化该列
  520.      If fld.Type = 6 Then
  521.         Dim f1 As StdDataFormat
  522.         Set f1 = DataGrid1.Columns(fld.Name).DataFormat
  523.         f1.Format = "##,##0.00"
  524.      End If
  525.   Next
  526. End Sub
  527. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  528.   sql1 = ""
  529. End Sub
  530. Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
  531.   Dim newsql As String
  532.   If sql1 <> "" And tb1 <> "" Then
  533.     newsql = Mid(sql1, Len(tb1), Len(sql1))
  534.   End If
  535.   Select Case Button.Key
  536.      Case "add"
  537.        blnAddHT = True
  538.        main_yyxx.Tag = 3
  539.        Load main_yyxx
  540.        main_yyxx.Show 1
  541.      Case "modify"
  542.        If Adodc1.Recordset.RecordCount > 0 Then
  543.          blnAddHT = False
  544.          Load main_rsgl_htgl_lr
  545.          main_rsgl_htgl_lr.Show 1
  546.        Else
  547.          MsgBox "系统没有要修改的数据!", , "提示窗口"
  548.        End If
  549.      Case "delete"
  550.        If Adodc1.Recordset.RecordCount > 0 Then
  551.          Adodc1.Recordset.Delete
  552.          Adodc1.Refresh
  553.        Else
  554.          For i = 5 To 15
  555.           Toolbar1.Buttons(i).Enabled = False
  556.          Next i
  557.          MsgBox "系统没有要删除的数据!", , "提示窗口"
  558.        End If
  559.      Case "find"
  560.        tb1 = "合同表"
  561.        Load main_fzfind
  562.        main_fzfind.Show 1
  563.      Case "all"
  564.        Adodc1.RecordSource = "合同表 order by 合同编号"
  565.        Adodc1.Refresh
  566.      Case "addpact"
  567.        Load main_htxy
  568.        main_htxy.Show 1
  569.      Case "takee"
  570.        If newsql <> "" Then
  571.          Cnn.Execute ("update 合同表 set 状态='生效' " & newsql & " and 员工编号='" + DataGrid1.Columns(0) + "'")
  572.        Else
  573.          Cnn.Execute ("update 合同表 set 状态='生效'where 员工编号='" + DataGrid1.Columns(0) + "'")
  574.        End If
  575.        Adodc1.Refresh
  576.      Case "undo"
  577.        If newsql <> "" Then
  578.          Cnn.Execute ("update 合同表 set 状态='解除' " & newsql & " and 员工编号='" + DataGrid1.Columns(0) + "'")
  579.        Else
  580.          Cnn.Execute ("update 合同表 set 状态='解除'where 员工编号='" + DataGrid1.Columns(0) + "'")
  581.        End If
  582.        Adodc1.Refresh
  583.      Case "test"
  584.        If newsql <> "" Then
  585.          Cnn.Execute ("update 合同表 set 状态='试用' " & newsql & " and 员工编号='" + DataGrid1.Columns(0) + "'")
  586.        Else
  587.          Cnn.Execute ("update 合同表 set 状态='试用' where 员工编号='" + DataGrid1.Columns(0) + "'")
  588.        End If
  589.        Adodc1.Refresh
  590.      Case "change"
  591.        If newsql <> "" Then
  592.          Cnn.Execute ("update 合同表 set 状态='生效' " & newsql & " and 员工编号='" + DataGrid1.Columns(0) + "'")
  593.        Else
  594.          Cnn.Execute ("update 合同表 set 状态='生效' where 员工编号='" + DataGrid1.Columns(0) + "'")
  595.        End If
  596.        Adodc1.Refresh
  597.      Case "atterm"
  598.        If newsql <> "" Then
  599.          Cnn.Execute ("update 合同表 set 状态='到期' " & newsql & " and 员工编号='" + DataGrid1.Columns(0) + "'and 合同结束日期>" & Date)
  600.        Else
  601.          Cnn.Execute ("update 合同表 set 状态='到期' where 员工编号='" + DataGrid1.Columns(0) + "'and 合同结束日期>" & Date)
  602.        End If
  603.        Adodc1.Refresh
  604.      Case "excel"
  605.        Dim r As Integer, c As Integer
  606.        Dim newxls As Excel.Application
  607.        Dim newbook As Excel.Workbook
  608.        Dim newsheet As Excel.Worksheet
  609.        Set newxls = CreateObject("Excel.Application") '创建excel应用程序,打开excel2000
  610.        Set newbook = newxls.Workbooks.Add   '创建工作簿
  611.        Set newsheet = newbook.Worksheets(1) '创建工作表
  612.        If sql1 <> "" Then
  613.          Adodc1.RecordSource = sql1
  614.          Adodc1.Refresh
  615.        End If
  616.        If Adodc1.Recordset.RecordCount > 0 Then
  617.           Adodc1.Recordset.MoveFirst
  618.          newxls.Visible = True
  619.          For i = 0 To DataGrid1.Columns.Count - 1
  620.               newsheet.Cells(1, i + 1) = DataGrid1.Columns(i).Caption
  621.          Next i
  622.          '指定表格内容
  623.          Do While Adodc1.Recordset.EOF = False
  624.             r = Adodc1.Recordset.AbsolutePosition
  625.             For c = 0 To DataGrid1.Columns.Count - 1
  626.                 newsheet.Cells(r + 1, c + 1) = DataGrid1.Columns(c)
  627.             Next c
  628.            Adodc1.Recordset.MoveNext
  629.             If Adodc1.Recordset.EOF = True Then
  630.               Exit Do
  631.               Adodc1.Recordset.MoveLast
  632.               DataGrid1.SetFocus
  633.             End If
  634.          Loop
  635. ErrSave:
  636.          Exit Sub
  637.          MsgBox Err.Description, , "提示窗口"
  638.          End If
  639.      Case "close"
  640.        Unload Me
  641.   End Select
  642. End Sub