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