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

企业管理

开发平台:

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