上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:30k
源码类别:

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
  3. Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "Tabctl32.ocx"
  4. Begin VB.Form XT_login 
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "百利/ERP5.0-人事管理登录"
  7.    ClientHeight    =   3765
  8.    ClientLeft      =   45
  9.    ClientTop       =   330
  10.    ClientWidth     =   4770
  11.    ControlBox      =   0   'False
  12.    Icon            =   "系统_登录窗体.frx":0000
  13.    KeyPreview      =   -1  'True
  14.    LinkTopic       =   "Form2"
  15.    LockControls    =   -1  'True
  16.    MaxButton       =   0   'False
  17.    MinButton       =   0   'False
  18.    ScaleHeight     =   3765
  19.    ScaleWidth      =   4770
  20.    StartUpPosition =   2  '屏幕中心
  21.    Begin VB.CheckBox QdCheck 
  22.       Caption         =   "是否修改"
  23.       Height          =   825
  24.       Left            =   4980
  25.       TabIndex        =   11
  26.       Top             =   1260
  27.       Value           =   1  'Checked
  28.       Width           =   705
  29.    End
  30.    Begin VB.CheckBox CtdrCheck 
  31.       Caption         =   "非第一次调入窗体"
  32.       Height          =   735
  33.       Left            =   4980
  34.       TabIndex        =   0
  35.       Top             =   390
  36.       Width           =   705
  37.    End
  38.    Begin TabDlg.SSTab StTab 
  39.       Height          =   3705
  40.       Left            =   60
  41.       TabIndex        =   12
  42.       Top             =   30
  43.       Width           =   4665
  44.       _ExtentX        =   8229
  45.       _ExtentY        =   6535
  46.       _Version        =   393216
  47.       Style           =   1
  48.       TabHeight       =   520
  49.       TabCaption(0)   =   "帐套选择及身份验证"
  50.       TabPicture(0)   =   "系统_登录窗体.frx":1042
  51.       Tab(0).ControlEnabled=   -1  'True
  52.       Tab(0).Control(0)=   "Frame1(0)"
  53.       Tab(0).Control(0).Enabled=   0   'False
  54.       Tab(0).ControlCount=   1
  55.       TabCaption(1)   =   "数据服务器连接设置"
  56.       TabPicture(1)   =   "系统_登录窗体.frx":105E
  57.       Tab(1).ControlEnabled=   0   'False
  58.       Tab(1).Control(0)=   "Frame1(1)"
  59.       Tab(1).ControlCount=   1
  60.       TabCaption(2)   =   "更改密码"
  61.       TabPicture(2)   =   "系统_登录窗体.frx":107A
  62.       Tab(2).ControlEnabled=   0   'False
  63.       Tab(2).Control(0)=   "Frame1(2)"
  64.       Tab(2).ControlCount=   1
  65.       Begin VB.Frame Frame1 
  66.          Height          =   3255
  67.          Index           =   0
  68.          Left            =   90
  69.          TabIndex        =   19
  70.          Top             =   330
  71.          Width           =   4455
  72.          Begin VB.CommandButton QxCommand 
  73.             Caption         =   "取消(&C)"
  74.             Height          =   300
  75.             Left            =   3210
  76.             TabIndex        =   23
  77.             Top             =   2790
  78.             Width           =   1120
  79.          End
  80.          Begin VB.CommandButton QdCommand 
  81.             Caption         =   "确定(&O)"
  82.             Height          =   300
  83.             Left            =   2040
  84.             TabIndex        =   6
  85.             Top             =   2790
  86.             Width           =   1120
  87.          End
  88.          Begin VB.ComboBox ZtCombo 
  89.             Height          =   300
  90.             Left            =   1050
  91.             Style           =   2  'Dropdown List
  92.             TabIndex        =   1
  93.             Top             =   210
  94.             Width           =   3315
  95.          End
  96.          Begin VB.ComboBox KjyearCombo 
  97.             Height          =   300
  98.             Left            =   1050
  99.             Style           =   2  'Dropdown List
  100.             TabIndex        =   2
  101.             Top             =   600
  102.             Width           =   3315
  103.          End
  104.          Begin VB.TextBox CzrqText 
  105.             Height          =   300
  106.             Left            =   1050
  107.             MaxLength       =   10
  108.             TabIndex        =   3
  109.             Top             =   990
  110.             Width           =   2985
  111.          End
  112.          Begin VB.CommandButton Rlcommand 
  113.             CausesValidation=   0   'False
  114.             Height          =   300
  115.             Left            =   4050
  116.             Picture         =   "系统_登录窗体.frx":1096
  117.             Style           =   1  'Graphical
  118.             TabIndex        =   22
  119.             Top             =   990
  120.             Width           =   300
  121.          End
  122.          Begin VB.ComboBox CzyCombo 
  123.             Height          =   300
  124.             Left            =   1050
  125.             TabIndex        =   4
  126.             Top             =   1380
  127.             Width           =   3315
  128.          End
  129.          Begin VB.TextBox MmText 
  130.             Height          =   300
  131.             IMEMode         =   3  'DISABLE
  132.             Left            =   1050
  133.             MaxLength       =   20
  134.             PasswordChar    =   "*"
  135.             TabIndex        =   5
  136.             Top             =   1770
  137.             Width           =   2730
  138.          End
  139.          Begin VB.Timer Timer1 
  140.             Interval        =   100
  141.             Left            =   420
  142.             Top             =   2550
  143.          End
  144.          Begin VB.CommandButton XgmaCommand 
  145.             Caption         =   "修改密码(&M)"
  146.             Height          =   300
  147.             Left            =   2040
  148.             TabIndex        =   21
  149.             Top             =   2430
  150.             Width           =   1120
  151.          End
  152.          Begin VB.CommandButton GgszCommand 
  153.             Caption         =   "更改设置(&A)"
  154.             Height          =   300
  155.             Left            =   3210
  156.             TabIndex        =   20
  157.             Top             =   2430
  158.             Width           =   1120
  159.          End
  160.          Begin VB.Label TsLabel 
  161.             Alignment       =   1  'Right Justify
  162.             Caption         =   "操作日期:"
  163.             Height          =   345
  164.             Index           =   3
  165.             Left            =   150
  166.             TabIndex        =   28
  167.             Top             =   1050
  168.             Width           =   825
  169.          End
  170.          Begin VB.Label TsLabel 
  171.             Alignment       =   1  'Right Justify
  172.             Caption         =   "会计年度:"
  173.             Height          =   345
  174.             Index           =   1
  175.             Left            =   150
  176.             TabIndex        =   27
  177.             Top             =   660
  178.             Width           =   825
  179.          End
  180.          Begin VB.Label TsLabel 
  181.             Alignment       =   1  'Right Justify
  182.             Caption         =   "公司帐套:"
  183.             Height          =   255
  184.             Index           =   0
  185.             Left            =   120
  186.             TabIndex        =   26
  187.             Top             =   270
  188.             Width           =   855
  189.          End
  190.          Begin VB.Label TsLabel 
  191.             Alignment       =   1  'Right Justify
  192.             AutoSize        =   -1  'True
  193.             Caption         =   "用户名:"
  194.             Height          =   180
  195.             Index           =   2
  196.             Left            =   165
  197.             TabIndex        =   25
  198.             Top             =   1410
  199.             Width           =   630
  200.          End
  201.          Begin VB.Label TsLabel 
  202.             Caption         =   "密码:"
  203.             Height          =   345
  204.             Index           =   4
  205.             Left            =   180
  206.             TabIndex        =   24
  207.             Top             =   1830
  208.             Width           =   585
  209.          End
  210.          Begin VB.Line Line1 
  211.             Index           =   0
  212.             X1              =   180
  213.             X2              =   4320
  214.             Y1              =   2280
  215.             Y2              =   2280
  216.          End
  217.          Begin VB.Line Line1 
  218.             BorderColor     =   &H00FFFFFF&
  219.             Index           =   1
  220.             X1              =   180
  221.             X2              =   4320
  222.             Y1              =   2310
  223.             Y2              =   2310
  224.          End
  225.          Begin VB.Image Image1 
  226.             Height          =   480
  227.             Left            =   3870
  228.             Picture         =   "系统_登录窗体.frx":1420
  229.             Top             =   1740
  230.             Width           =   480
  231.          End
  232.       End
  233.       Begin VB.Frame Frame1 
  234.          Height          =   3255
  235.          Index           =   1
  236.          Left            =   -74910
  237.          TabIndex        =   18
  238.          Top             =   330
  239.          Width           =   4455
  240.          Begin VB.CommandButton LjqxCommand 
  241.             Caption         =   "取 消"
  242.             Height          =   300
  243.             Left            =   2580
  244.             TabIndex        =   31
  245.             Top             =   1440
  246.             Width           =   1120
  247.          End
  248.          Begin VB.CommandButton LjqdCommand 
  249.             Caption         =   "确 定"
  250.             Height          =   300
  251.             Left            =   1410
  252.             TabIndex        =   30
  253.             Top             =   1440
  254.             Width           =   1120
  255.          End
  256.          Begin VB.TextBox ServerText 
  257.             Height          =   300
  258.             Left            =   1800
  259.             TabIndex        =   29
  260.             Top             =   660
  261.             Width           =   1905
  262.          End
  263.          Begin MSComCtl2.Animation Animation1 
  264.             Height          =   615
  265.             Left            =   150
  266.             TabIndex        =   32
  267.             Top             =   1290
  268.             Visible         =   0   'False
  269.             Width           =   705
  270.             _ExtentX        =   1244
  271.             _ExtentY        =   1085
  272.             _Version        =   393216
  273.             Center          =   -1  'True
  274.             BackStyle       =   1
  275.             FullWidth       =   47
  276.             FullHeight      =   41
  277.          End
  278.          Begin VB.Label DdtsLabel 
  279.             ForeColor       =   &H00FF0000&
  280.             Height          =   255
  281.             Left            =   1110
  282.             TabIndex        =   34
  283.             Top             =   2490
  284.             Width           =   3045
  285.          End
  286.          Begin VB.Label TsLabel 
  287.             Alignment       =   1  'Right Justify
  288.             AutoSize        =   -1  'True
  289.             Caption         =   "数据服务器:"
  290.             Height          =   180
  291.             Index           =   7
  292.             Left            =   765
  293.             TabIndex        =   33
  294.             Top             =   720
  295.             Width           =   990
  296.          End
  297.       End
  298.       Begin VB.Frame Frame1 
  299.          Height          =   3255
  300.          Index           =   2
  301.          Left            =   -74910
  302.          TabIndex        =   13
  303.          Top             =   330
  304.          Width           =   4455
  305.          Begin VB.TextBox LrText 
  306.             Height          =   300
  307.             IMEMode         =   3  'DISABLE
  308.             Index           =   0
  309.             Left            =   1110
  310.             MaxLength       =   20
  311.             PasswordChar    =   "*"
  312.             TabIndex        =   7
  313.             Top             =   420
  314.             Width           =   3210
  315.          End
  316.          Begin VB.CommandButton MmqdCommand 
  317.             Caption         =   "确定(&O)"
  318.             Height          =   300
  319.             Left            =   1110
  320.             TabIndex        =   10
  321.             Top             =   2160
  322.             Width           =   1120
  323.          End
  324.          Begin VB.CommandButton MmqxCommand 
  325.             Caption         =   "取消(&C)"
  326.             Height          =   300
  327.             Left            =   2280
  328.             TabIndex        =   14
  329.             Top             =   2160
  330.             Width           =   1125
  331.          End
  332.          Begin VB.TextBox LrText 
  333.             Height          =   300
  334.             IMEMode         =   3  'DISABLE
  335.             Index           =   1
  336.             Left            =   1110
  337.             MaxLength       =   20
  338.             PasswordChar    =   "*"
  339.             TabIndex        =   8
  340.             Top             =   810
  341.             Width           =   3210
  342.          End
  343.          Begin VB.TextBox LrText 
  344.             Height          =   300
  345.             IMEMode         =   3  'DISABLE
  346.             Index           =   2
  347.             Left            =   1110
  348.             MaxLength       =   20
  349.             PasswordChar    =   "*"
  350.             TabIndex        =   9
  351.             Top             =   1200
  352.             Width           =   3210
  353.          End
  354.          Begin VB.Line Line1 
  355.             Index           =   2
  356.             X1              =   240
  357.             X2              =   4290
  358.             Y1              =   1770
  359.             Y2              =   1770
  360.          End
  361.          Begin VB.Label TsLabel 
  362.             AutoSize        =   -1  'True
  363.             Caption         =   "旧密码:"
  364.             Height          =   180
  365.             Index           =   14
  366.             Left            =   240
  367.             TabIndex        =   17
  368.             Top             =   480
  369.             Width           =   630
  370.          End
  371.          Begin VB.Label TsLabel 
  372.             AutoSize        =   -1  'True
  373.             Caption         =   "新密码:"
  374.             Height          =   180
  375.             Index           =   15
  376.             Left            =   240
  377.             TabIndex        =   16
  378.             Top             =   870
  379.             Width           =   630
  380.          End
  381.          Begin VB.Label TsLabel 
  382.             AutoSize        =   -1  'True
  383.             Caption         =   "确认密码:"
  384.             Height          =   180
  385.             Index           =   16
  386.             Left            =   240
  387.             TabIndex        =   15
  388.             Top             =   1260
  389.             Width           =   810
  390.          End
  391.          Begin VB.Line Line1 
  392.             BorderColor     =   &H00FFFFFF&
  393.             Index           =   3
  394.             X1              =   240
  395.             X2              =   4260
  396.             Y1              =   1800
  397.             Y2              =   1800
  398.          End
  399.       End
  400.    End
  401. End
  402. Attribute VB_Name = "XT_login"
  403. Attribute VB_GlobalNameSpace = False
  404. Attribute VB_Creatable = False
  405. Attribute VB_PredeclaredId = True
  406. Attribute VB_Exposed = False
  407. Dim Xtsjljc As String                       '系统数据服务器连接串
  408. Dim ErpPassWord As String                   '系统连接密码
  409. Dim Cslj As New ADODB.Connection            '测试连接(为屏蔽提示信息)
  410. Dim Tsxx As String                          '系统提示信息
  411. Dim Czyrec As New ADODB.Recordset           '操作员动态集
  412. Dim Xtrlrec As New ADODB.Recordset          '系统日历动态集
  413. Dim Ztdqsjk As String                       '所选帐套当前数据库
  414. Private Function Ljyxxpd() As Boolean       '数据服务器(系统基本信息库)连接有效性测试
  415.     Ljyxxpd = False
  416.     If Len(Trim(ServerText.Text)) = 0 Then
  417.         Tsxx = "数据服务器名不能为空!"
  418.         Call Xtxxts(Tsxx, 0, 1)
  419.         ServerText.SetFocus
  420.         Exit Function
  421.     End If
  422.     Xtsjljc = "Provider=SQLOLEDB.1;"
  423.     
  424.     Xtsjljc = Xtsjljc + "Persist Security Info=False;"
  425.     
  426.     Xtsjljc = Xtsjljc + "Data Source=" + Trim(ServerText.Text) + ";"
  427.     
  428.     Xtsjljc = Xtsjljc + " Initial Catalog=" + "Master" + ";"
  429.     
  430.     If Cslj.State = 1 Then Cslj.Close
  431.     
  432.     DdtsLabel = "系统正在连接数据服务器,请稍等..."
  433.     DdtsLabel.Refresh
  434.     With Me.Animation1
  435.         .Visible = True
  436.         .Open App.Path + "Ljcs.avi"
  437.         .Play
  438.     End With
  439.     On Error GoTo Cwcl
  440.     
  441.     If Cslj.State = 1 Then Cslj.Close
  442.     Cslj.Open Xtsjljc, "Hxxd", ErpPassWord
  443.     
  444.     Animation1.Stop
  445.     Animation1.Visible = False
  446.     
  447.     DdtsLabel = ""
  448.     DdtsLabel.Refresh
  449.       
  450.     Ljyxxpd = True
  451.     
  452.     Exit Function
  453.     
  454. Cwcl:
  455.     Animation1.Visible = False
  456.     Animation1.Stop
  457.     DdtsLabel = ""
  458.     Tsxx = "数据服务器连接测试失败!"
  459.     Call Xtxxts(Tsxx, 0, 1)
  460.     Exit Function
  461.   
  462. End Function
  463. Private Sub CzrqText_KeyPress(KeyAscii As Integer)      '录入日期限制
  464.     Call Lrrqxz(KeyAscii)
  465. End Sub
  466. Private Sub Form_KeyPress(KeyAscii As Integer)          '控 制 焦 点 转 移
  467.     Dim jdzygs As Integer
  468.     jdzygs = 12
  469.     Select Case KeyAscii
  470.         Case vbKeyReturn
  471.             If Kjjdzy(jdzygs) Then
  472.                 KeyAscii = 0
  473.             End If
  474.         Case 39           '屏蔽"'"
  475.             KeyAscii = 0
  476.     End Select
  477. End Sub
  478. Private Sub Form_Load()
  479.     App.HelpFile = App.Path + "人事管理.chm"
  480.     
  481.     XtMenuList = "21%"         '子系统菜单系统代号
  482.     
  483.     ErpPassWord = "123"
  484.     
  485.     Call Qcljnr     '读入连接内容
  486.     
  487.     With StTab
  488.         .TabEnabled(0) = False
  489.         Frame1(0).Enabled = False
  490.         .TabEnabled(1) = True
  491.         Frame1(1).Enabled = True
  492.         .TabEnabled(2) = False
  493.         Frame1(2).Enabled = False
  494.          StTab.Tab = 1
  495.     End With
  496.     
  497. End Sub
  498. Private Sub GgszCommand_Click()
  499.     With Me.StTab
  500.         .TabEnabled(0) = False
  501.         Frame1(0).Enabled = False
  502.         .TabEnabled(1) = True
  503.         Frame1(1).Enabled = True
  504.         .Tab = 1
  505.     End With
  506.     
  507.     ' 让数据服务器设置文本框得到焦点
  508.     ServerText.SetFocus
  509.     ServerText.SelStart = 0
  510.     ServerText.SelLength = Len(ServerText.Text)
  511. End Sub
  512. Private Sub LjqdCommand_Click()                              '保 存 设 置
  513.  
  514.     If Ljyxxpd Then
  515.         If Cw_DataEnvi.BaseInfoConnect.State = 1 Then Cw_DataEnvi.BaseInfoConnect.Close
  516.         Cw_DataEnvi.BaseInfoConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  517.         
  518.         Tsxx = "连接测试成功!"
  519.         Call Xtxxts(Tsxx, 0, 4)
  520.         
  521.         StTab.TabEnabled(1) = False
  522.         Frame1(1).Enabled = False
  523.         StTab.TabEnabled(0) = True
  524.         Frame1(0).Enabled = True
  525.         StTab.Tab = 0
  526.         Call Tcztxx
  527.         
  528.         If ZtCombo.ListCount > 0 Then
  529.             ZtCombo.ListIndex = 0
  530.         End If
  531.     End If
  532. End Sub
  533. Private Sub Qcljnr()                                         '取 出 数 据
  534.     Dim Fsote As New FileSystemObject, Tste As TextStream
  535.     Dim Dqhs As Integer, Dqnr As String
  536.     Dqhs = 5
  537.     On Error GoTo Cwcl:
  538.     Set Tste = Fsote.OpenTextFile(App.Path + "百利erp.txt", 1)
  539.     For jsqte = 1 To Dqhs
  540.         Dqnr = Trim(Tste.ReadLine)
  541.         If InStr(1, UCase(Dqnr), "SQLSERVER=") <> 0 Then
  542.             ServerText.Text = Mid(Dqnr, InStr(1, UCase(Dqnr), "SQLSERVER=") + 10, Len(Dqnr))
  543.         End If
  544.         If InStr(1, UCase(Dqnr), "ACCOUNT=") <> 0 Then
  545.             str_Account = Mid(Dqnr, InStr(1, UCase(Dqnr), "ACCOUNT=") + 8, Len(Dqnr))
  546.             Dim int_Count As Integer
  547.              
  548.             For int_Count = 0 To ZtCombo.ListCount - 1
  549.                 If UCase(Mid(ZtCombo.List(int_Count), 1, InStr(ZtCombo.List(int_Count), "-") - 1)) = UCase(Mid(str_Account, 1, InStr(str_Account, "-") - 1)) Then
  550.                     ZtCombo.ListIndex = int_Count
  551.                 End If
  552.             Next int_Count
  553.         End If
  554.     Next jsqte
  555.     Exit Sub
  556. Cwcl:
  557.     Exit Sub
  558. End Sub
  559. Private Sub QdCommand_Click()          '确定进入系统
  560.     If Trim(CzyCombo.Text) = "" Then Exit Sub
  561.     
  562.     Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl where czybm='" + Trim(CzyCombo.Text) + "' or czymc='" & Trim(CzyCombo.Text) & "' or rtrim(czybm)+'-'+rtrim(czymc)='" & Trim(CzyCombo.Text) & "'")
  563.     With Czyrec
  564.         If Not .EOF Then
  565.         CzyCombo.Text = Trim(.Fields("czybm")) + "-" + Trim(.Fields("czymc"))
  566.         Else
  567.             Tsxx = "无此用户名!"
  568.             Call Xtxxts(Tsxx, 0, 1)
  569.             Exit Sub
  570.         End If
  571.     End With
  572.     Czyrec.Close
  573.     Set Czyrec = Nothing
  574.     If Xtyxxpd Then
  575.         If Ljyxxpd1 Then
  576.             If Cw_DataEnvi.DataConnect.State = 1 Then Cw_DataEnvi.DataConnect.Close
  577.             Cw_DataEnvi.DataConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  578.         End If
  579.         QdCheck.Value = 1
  580.         Me.Hide
  581.         
  582.         Dim Fsote As New FileSystemObject, Tste As TextStream
  583.         Set Tste = Fsote.CreateTextFile(App.Path + "百利erp.txt", True)
  584.         Tste.WriteLine "Sqlserver=" + Trim(ServerText.Text)
  585.         Tste.WriteLine "Account=" + Trim(ZtCombo.Text)
  586.         Tste.Close
  587.         
  588.         CtdrCheck.Value = 1
  589.         GgszCommand.Enabled = False
  590.         XT_Main.Show
  591.         
  592. '        Xt_Control.tvTreeView.Visible = False
  593. '        Xt_Control.tvTreeView.Nodes.Clear
  594. '        Xt_Control.Cshgns
  595. '        Xt_Control.tvTreeView.Refresh
  596. '        Xt_Control.tvTreeView.Visible = True
  597.     End If
  598. End Sub
  599. Private Sub QxCommand_Click()                                     '取消进入系统
  600.     If CtdrCheck.Value <> 1 Then
  601.         Unload Me
  602.     Else
  603.         Me.Hide
  604.     End If
  605. End Sub
  606. Private Sub Rlcommand_Click()                                     '操作日期帮助
  607.     Call Czrqbz
  608. End Sub
  609. Private Sub Timer1_Timer()                                        '激活连接测试
  610.     Timer1.Enabled = False
  611.     
  612.     If Ljyxxpd Then
  613.         If Cw_DataEnvi.BaseInfoConnect.State = 1 Then Cw_DataEnvi.BaseInfoConnect.Close
  614.         Cw_DataEnvi.BaseInfoConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  615.     Else
  616.         Exit Sub
  617.     End If
  618.     
  619.     With StTab
  620.         .TabEnabled(1) = False
  621.         Frame1(1).Enabled = False
  622.         .TabEnabled(0) = True
  623.         Frame1(0).Enabled = True
  624.     End With
  625.     
  626.     StTab.Tab = 0
  627.       
  628.     Call Tcztxx
  629.     Qcljnr
  630.     
  631.     '让用户名录入框得到焦点
  632.     CzyCombo.SetFocus
  633. End Sub
  634. Private Sub LjqxCommand_Click()                                   '连接失败退出
  635.     If CtdrCheck.Value <> 1 Then
  636.         Unload Me
  637.     Else
  638.         Me.Hide
  639.     End If
  640. End Sub
  641. Private Sub Tcztxx()                                              '填充帐套信息选择
  642.     Dim Xtztxxrec As New ADODB.Recordset        '系统帐套信息动态集
  643.     Set Xtztxxrec = Cw_DataEnvi.BaseInfoConnect.Execute("Select * From HDSystem_Databases order by number")
  644.     ZtCombo.Clear
  645.     With Xtztxxrec
  646.         Do While Not .EOF
  647.             If .Fields("YNuse") = "1" Then
  648.                 ZtCombo.AddItem .Fields("number") + "-" + Trim(.Fields("CountingRoomName"))
  649.             End If
  650.             .MoveNext
  651.         Loop
  652.     End With
  653. End Sub
  654. Private Sub ZtCombo_Click()
  655.     Dim Xtztxxrec As New ADODB.Recordset        '系统帐套信息动态集
  656.     Dim RecTemp As New ADODB.Recordset
  657.     Dim Xt_Id As Integer                         '该模块系统的ID号
  658.     
  659.     On Error GoTo ErrHandle
  660.     Set Xtztxxrec = Cw_DataEnvi.BaseInfoConnect.Execute("Select * From HDSystem_DataBases where Number='" + Trim(Mid(ZtCombo.Text, 1, InStr(1, ZtCombo.Text, "-") - 1)) + "'")
  661.     With Xtztxxrec
  662.         If Not .EOF Then
  663.             Ztdqsjk = Trim(.Fields("DataBasesName"))
  664.         End If
  665.     End With
  666.     If Ljyxxpd1 Then
  667.         If Cw_DataEnvi.DataConnect.State = 1 Then Cw_DataEnvi.DataConnect.Close
  668.         Cw_DataEnvi.DataConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  669.     Else
  670.         Exit Sub
  671.     End If
  672.    
  673.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select ID From Xt_Xtgnb  Where gnbm='21'")
  674.     If RecTemp.EOF = False Then
  675.         Xt_Id = RecTemp.Fields("ID")
  676.         Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl Where  right(left(AuthorityId," & Xt_Id & "),1)='1' order by czybm")
  677.         XgmaCommand.Enabled = True
  678.         QdCommand.Enabled = True
  679.         CzyCombo.Enabled = True
  680.     Else
  681.         XgmaCommand.Enabled = False
  682.         QdCommand.Enabled = False
  683.         CzyCombo.Text = ""
  684.         CzyCombo.Enabled = False
  685.         Tsxx = "请将该系统的操作权限赋予操作员!"
  686.         Call Xtxxts(Tsxx, 0, 4)
  687.         Exit Sub
  688.     End If
  689.     Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl order by czybm")
  690.     CzyCombo.Clear
  691.     With Czyrec
  692.         Do While Not .EOF
  693.             CzyCombo.AddItem Trim(.Fields("czybm")) + "-" + Trim(.Fields("czymc"))
  694.             .MoveNext
  695.         Loop
  696.         CzyCombo.Text = CzyCombo.List(0)
  697.     End With
  698.     Set Xtrlrec = Cw_DataEnvi.DataConnect.Execute("Select distinct kjyear From gy_kjrlb order by kjyear ")
  699.     KjyearCombo.Clear
  700.     With Xtrlrec
  701.         Do While Not .EOF
  702.            KjyearCombo.AddItem Trim(.Fields("kjyear"))
  703.            .MoveNext
  704.         Loop
  705.     End With
  706.     
  707.     Set Xtrlrec = Cw_DataEnvi.DataConnect.Execute("Select top 1 kjyear From gy_kjrlb order by kjyear DESC,period ")
  708.     If Not Xtrlrec.EOF Then
  709.         KjyearCombo.Text = Xtrlrec.Fields("Kjyear")
  710.     End If
  711.    
  712.     Call Drxtztcs             '读入系统帐套参数
  713.   
  714.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select ServerDate=getdate()")
  715.     CzrqText = Format(RecTemp.Fields("ServerDate"), "yyyy-mm-dd")
  716.    
  717. ErrHandle:
  718.    
  719. End Sub
  720. Private Sub Czrqbz()                                                  '操作日期帮助
  721.     Xtcdcs = Trim(CzrqText.Text)
  722.     Xtfhcs = ""
  723.     XT_calendar.Show 1
  724.     If Xtfhcs <> "" Then
  725.         CzrqText.Text = Trim(Xtfhcs)
  726.     End If
  727.     CzrqText.SetFocus
  728. End Sub
  729. Private Sub CzrqText_KeyDown(KeyCode As Integer, Shift As Integer)    '操作日期帮助
  730.     If KeyCode = vbKeyF2 Then
  731.         Call Czrqbz
  732.     End If
  733. End Sub
  734. Private Function Xtyxxpd() As Boolean                                                   '系统有效性判断
  735.     Xtyxxpd = False
  736.     If Len(Trim(ZtCombo.Text)) = 0 Then
  737.         Tsxx = "公司帐套不能为空,请先建帐套!"
  738.         Call Xtxxts(Tsxx, 0, 1)
  739.         ZtCombo.SetFocus
  740.         Exit Function
  741.     End If
  742.     lsblte = Trim(CzrqText.Text)
  743.     If IsDate(lsblte) Then
  744.         CzrqText.Text = Format(lsblte, "yyyy-mm-dd")
  745.     Else
  746.         Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
  747.         Call Xtxxts(Tsxx, 0, 1)
  748.         Xtyxxpd = False
  749.         CzrqText.SetFocus
  750.         Exit Function
  751.     End If
  752.     If Val(KjyearCombo.Text) <> Val(Mid(CzrqText.Text, 1, 4)) Then
  753.         Tsxx = "所选操作日期与会计年度不一致!"
  754.         Call Xtxxts(Tsxx, 0, 1)
  755.         Xtyxxpd = False
  756.         CzrqText.SetFocus
  757.         Exit Function
  758.     End If
  759.     
  760.     If Trim(CzyCombo.Text) = "" Then
  761.         Tsxx = "用户名不能为空!"
  762.         Call Xtxxts(Tsxx, 0, 1)
  763.         Xtyxxpd = False
  764.         CzyCombo.SetFocus
  765.         Exit Function
  766.     End If
  767.     
  768.     Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl where czybm='" + Trim(Mid(CzyCombo.Text, 1, InStr(1, CzyCombo.Text, "-") - 1)) + "'")
  769.     With Czyrec
  770.         If Not .EOF Then
  771.             If Trim(.Fields("czmm")) <> Mmjm(MmText.Text) Then
  772.                 Tsxx = "操作员密码录入错误!"
  773.                 Call Xtxxts(Tsxx, 0, 1)
  774.                 Xtyxxpd = False
  775.                 MmText.SetFocus
  776.                 Exit Function
  777.             End If
  778.         Else
  779.             Tsxx = "无此操作员!"
  780.             Call Xtxxts(Tsxx, 0, 1)
  781.             Xtyxxpd = False
  782.             CzyCombo.SetFocus
  783.             Exit Function
  784.         End If
  785.    End With
  786.    Xtyxxpd = True
  787. End Function
  788. Private Function Ljyxxpd1() As Boolean                  '数据服务器(帐套当前数据库)连接有效性测试
  789.     Ljyxxpd1 = False
  790.     Xtsjljc = "Provider=SQLOLEDB.1;"
  791.     
  792.     Xtsjljc = Xtsjljc + "Persist Security Info=False;"
  793.     
  794.     Xtsjljc = Xtsjljc + "Data Source=" + Trim(ServerText.Text) + ";"
  795.     
  796.     Xtsjljc = Xtsjljc + " Initial Catalog=" + Ztdqsjk + ";"
  797.     
  798.     On Error GoTo Cwcl
  799.     If Cslj.State = 1 Then Cslj.Close
  800.     Cslj.Open Xtsjljc, "Hxxd", ErpPassWord
  801.     
  802.     Ljyxxpd1 = True
  803.     Exit Function
  804.     
  805. Cwcl:
  806.     Tsxx = "帐套数据库连接失败!"
  807.     Call Xtxxts(Tsxx, 0, 1)
  808.     Exit Function
  809. End Function
  810. Private Sub XgmaCommand_Click()                '修改密码
  811.     If Trim(CzyCombo.Text) = "" Then Exit Sub
  812.     
  813.     Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl where czybm='" + Trim(CzyCombo.Text) + "' or czymc='" & Trim(CzyCombo.Text) & "' or rtrim(czybm)+'-'+rtrim(czymc)='" & Trim(CzyCombo.Text) & "'")
  814.     With Czyrec
  815.         If Not .EOF Then
  816.         CzyCombo.Text = Trim(.Fields("czybm")) + "-" + Trim(.Fields("czymc"))
  817.         Else
  818.             Tsxx = "无此用户名!"
  819.             Call Xtxxts(Tsxx, 0, 1)
  820.             Exit Sub
  821.         End If
  822.     End With
  823.     Czyrec.Close
  824.     Set Czyrec = Nothing
  825.     
  826.     
  827.     With StTab
  828.         .TabEnabled(0) = False
  829.         Frame1(0).Enabled = False
  830.         .TabEnabled(2) = True
  831.         Frame1(2).Enabled = True
  832.         .Tab = 2
  833.     End With
  834.     LrText(0).Text = Trim(MmText.Text)
  835.     LrText(1).Text = ""
  836.     LrText(2).Text = ""
  837.     LrText(0).SetFocus
  838. End Sub
  839. Private Sub MmqdCommand_Click()                '修改密码完毕确定
  840.     With Czyrec
  841.         If .State = 1 Then .Close
  842.         .Open "SELECT * FROM gy_czygl WHERE czybm= '" + Trim(Mid(CzyCombo.Text, 1, InStr(1, CzyCombo.Text, "-") - 1)) + "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  843.         If .EOF Then
  844.             Tsxx = "此操作员已删除!"
  845.             Call Xtxxts(Tsxx, 0, 1)
  846.             Exit Sub
  847.         End If
  848.         If Trim(.Fields("czmm")) <> Mmjm(Trim(LrText(0).Text)) Then
  849.             Tsxx = "输入旧密码错误!"
  850.             Call Xtxxts(Tsxx, 0, 1)
  851.             LrText(0).SetFocus
  852.             Exit Sub
  853.         End If
  854.         If Len(Trim(LrText(1).Text)) = 0 Then
  855.             Tsxx = "操作员密码不能为空!"
  856.             Call Xtxxts(Tsxx, 0, 1)
  857.             LrText(1).SetFocus
  858.             Exit Sub
  859.         End If
  860.         If Trim(LrText(0).Text) = Trim(LrText(1).Text) Then
  861.             Tsxx = "密码没有发生改变!"
  862.             Call Xtxxts(Tsxx, 0, 1)
  863.             LrText(1).SetFocus
  864.             Exit Sub
  865.         End If
  866.         If Trim(LrText(1).Text) <> Trim(LrText(2).Text) Then
  867.             Tsxx = "输入密码与确认密码不一致!"
  868.             Call Xtxxts(Tsxx, 0, 1)
  869.             LrText(1).SetFocus
  870.             Exit Sub
  871.         End If
  872.         .Fields("czmm") = Mmjm(Trim(LrText(1).Text))
  873.         .Fields("xgrq") = Date
  874.         .Update
  875.         MmText.Text = Trim(LrText(1).Text)
  876.         Tsxx = "用户密码修改完毕!"
  877.         Call Xtxxts(Tsxx, 0, 4)
  878.     End With
  879.     With StTab
  880.         .TabEnabled(0) = True
  881.         Frame1(0).Enabled = True
  882.         .TabEnabled(2) = False
  883.         Frame1(2).Enabled = False
  884.         .Tab = 0
  885.     End With
  886. End Sub
  887. Private Sub MmqxCommand_Click()                          '修改密码取消
  888.     With StTab
  889.         .TabEnabled(0) = True
  890.         Frame1(0).Enabled = True
  891.         .TabEnabled(2) = False
  892.         Frame1(2).Enabled = False
  893.         .Tab = 0
  894.     End With
  895. End Sub