上传用户: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      =   2025
  9.    ClientTop       =   1995
  10.    ClientWidth     =   4770
  11.    ControlBox      =   0   'False
  12.    HelpContextID   =   211001
  13.    Icon            =   "系统_登录窗体.frx":0000
  14.    KeyPreview      =   -1  'True
  15.    LinkTopic       =   "Form2"
  16.    MaxButton       =   0   'False
  17.    MinButton       =   0   'False
  18.    ScaleHeight     =   3765
  19.    ScaleWidth      =   4770
  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":038A
  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":03A6
  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":03C2
  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":03DE
  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":0768
  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.     Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
  480.     
  481.     XtMenuList = "02%"         '子系统菜单系统代号
  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.     On Error Resume Next
  535.     Dim int_Count As Integer
  536.     
  537.     ServerText.Text = ReadOneString("Option", "SqlServer", "localhost")
  538.     str_Account = ReadOneString("Option", "Account", "")
  539.     
  540.     For int_Count = 0 To ZtCombo.ListCount - 1
  541.         If UCase(Mid(ZtCombo.List(int_Count), 1, InStr(ZtCombo.List(int_Count), "-") - 1)) = UCase(Mid(str_Account, 1, InStr(str_Account, "-") - 1)) Then
  542.             ZtCombo.ListIndex = int_Count
  543.         End If
  544.     Next int_Count
  545. End Sub
  546. Private Sub QdCommand_Click()          '确定进入系统
  547.     If Trim(CzyCombo.Text) = "" Then Exit Sub
  548.     
  549.     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) & "'")
  550.     With Czyrec
  551.         If Not .EOF Then
  552.         CzyCombo.Text = Trim(.Fields("czybm")) + "-" + Trim(.Fields("czymc"))
  553.         Else
  554.             Tsxx = "无此用户名!"
  555.             Call Xtxxts(Tsxx, 0, 1)
  556.             Exit Sub
  557.         End If
  558.     End With
  559.     Czyrec.Close
  560.     Set Czyrec = Nothing
  561.     If Xtyxxpd Then
  562.         If Ljyxxpd1 Then
  563.             If Cw_DataEnvi.DataConnect.State = 1 Then Cw_DataEnvi.DataConnect.Close
  564.             Cw_DataEnvi.DataConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  565.         End If
  566.         QdCheck.Value = 1
  567.         Me.Hide
  568.         
  569.         Call WriteOneString("Option", "SqlServer", Trim(ServerText.Text))
  570.         Call WriteOneString("Option", "Account", Trim(ZtCombo.Text))
  571.         
  572.         CtdrCheck.Value = 1
  573.         GgszCommand.Enabled = False
  574.         XT_Main.Show
  575.         
  576.         Xt_Control.tvTreeView.Visible = False
  577.         Xt_Control.tvTreeView.Nodes.Clear
  578.         Xt_Control.Cshgns
  579.         Xt_Control.tvTreeView.Refresh
  580.         Xt_Control.tvTreeView.Visible = True
  581.     End If
  582. End Sub
  583. Private Sub QxCommand_Click()                                     '取消进入系统
  584.     If CtdrCheck.Value <> 1 Then
  585.         Unload Me
  586.     Else
  587.         Me.Hide
  588.     End If
  589. End Sub
  590. Private Sub Rlcommand_Click()                                     '操作日期帮助
  591.     Call Czrqbz
  592. End Sub
  593. Private Sub Timer1_Timer()                                        '激活连接测试
  594.     Timer1.Enabled = False
  595.     
  596.     If Ljyxxpd Then
  597.         If Cw_DataEnvi.BaseInfoConnect.State = 1 Then Cw_DataEnvi.BaseInfoConnect.Close
  598.         Cw_DataEnvi.BaseInfoConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  599.     Else
  600.         Exit Sub
  601.     End If
  602.     
  603.     With StTab
  604.         .TabEnabled(1) = False
  605.         Frame1(1).Enabled = False
  606.         .TabEnabled(0) = True
  607.         Frame1(0).Enabled = True
  608.     End With
  609.     
  610.     StTab.Tab = 0
  611.       
  612.     Call Tcztxx
  613.     Qcljnr
  614.     
  615.     '让用户名录入框得到焦点
  616.     CzyCombo.SetFocus
  617. End Sub
  618. Private Sub LjqxCommand_Click()                                   '连接失败退出
  619.     If CtdrCheck.Value <> 1 Then
  620.         Unload Me
  621.     Else
  622.         Me.Hide
  623.     End If
  624. End Sub
  625. Private Sub Tcztxx()                                              '填充帐套信息选择
  626.     Dim Xtztxxrec As New ADODB.Recordset        '系统帐套信息动态集
  627.     Set Xtztxxrec = Cw_DataEnvi.BaseInfoConnect.Execute("Select * From HDSystem_Databases order by number")
  628.     ZtCombo.Clear
  629.     With Xtztxxrec
  630.         Do While Not .EOF
  631.             If .Fields("YNuse") = "1" Then
  632.                 ZtCombo.AddItem .Fields("number") + "-" + Trim(.Fields("CountingRoomName"))
  633.             End If
  634.             .MoveNext
  635.         Loop
  636.     End With
  637. End Sub
  638. Private Sub ZtCombo_Click()
  639.     Dim Xtztxxrec As New ADODB.Recordset        '系统帐套信息动态集
  640.     Dim RecTemp As New ADODB.Recordset
  641.     Dim Xt_Id As Integer                         '该模块系统的ID号
  642.     
  643.     On Error GoTo ErrHandle
  644.     Set Xtztxxrec = Cw_DataEnvi.BaseInfoConnect.Execute("Select * From HDSystem_DataBases where Number='" + Trim(Mid(ZtCombo.Text, 1, InStr(1, ZtCombo.Text, "-") - 1)) + "'")
  645.     With Xtztxxrec
  646.         If Not .EOF Then
  647.             Ztdqsjk = Trim(.Fields("DataBasesName"))
  648.         End If
  649.     End With
  650.     If Ljyxxpd1 Then
  651.         If Cw_DataEnvi.DataConnect.State = 1 Then Cw_DataEnvi.DataConnect.Close
  652.         Cw_DataEnvi.DataConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  653.     Else
  654.         Exit Sub
  655.     End If
  656.    
  657.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select ID From Xt_Xtgnb  Where gnbm='01'")
  658.     If RecTemp.EOF = False Then
  659.         Xt_Id = RecTemp.Fields("ID")
  660.         Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl Where  right(left(AuthorityId," & Xt_Id & "),1)='1' order by czybm")
  661.         XgmaCommand.Enabled = True
  662.         QdCommand.Enabled = True
  663.         CzyCombo.Enabled = True
  664.     Else
  665.         XgmaCommand.Enabled = False
  666.         QdCommand.Enabled = False
  667.         CzyCombo.Text = ""
  668.         CzyCombo.Enabled = False
  669.         Tsxx = "请将该系统的操作权限赋予操作员!"
  670.         Call Xtxxts(Tsxx, 0, 4)
  671.         Exit Sub
  672.     End If
  673.     Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl order by czybm")
  674.     CzyCombo.Clear
  675.     With Czyrec
  676.         Do While Not .EOF
  677.             CzyCombo.AddItem Trim(.Fields("czybm")) + "-" + Trim(.Fields("czymc"))
  678.             .MoveNext
  679.         Loop
  680.         CzyCombo.Text = CzyCombo.List(0)
  681.     End With
  682.     Set Xtrlrec = Cw_DataEnvi.DataConnect.Execute("Select distinct kjyear From gy_kjrlb order by kjyear ")
  683.     KjyearCombo.Clear
  684.     With Xtrlrec
  685.         Do While Not .EOF
  686.            KjyearCombo.AddItem Trim(.Fields("kjyear"))
  687.            .MoveNext
  688.         Loop
  689.     End With
  690.     
  691.     Set Xtrlrec = Cw_DataEnvi.DataConnect.Execute("Select top 1 kjyear From gy_kjrlb where Arjzbz=0 order by kjyear desc,period ")
  692.     If Not Xtrlrec.EOF Then
  693.         KjyearCombo.Text = Xtrlrec.Fields("Kjyear")
  694.     End If
  695.    
  696.     Call Drxtztcs             '读入系统帐套参数
  697.   
  698.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select ServerDate=getdate()")
  699.     CzrqText = Format(RecTemp.Fields("ServerDate"), "yyyy-mm-dd")
  700.    
  701. ErrHandle:
  702.    
  703. End Sub
  704. Private Sub Czrqbz()                                                  '操作日期帮助
  705.     Xtcdcs = Trim(CzrqText.Text)
  706.     Xtfhcs = ""
  707.     XT_calendar.Show 1
  708.     If Xtfhcs <> "" Then
  709.         CzrqText.Text = Trim(Xtfhcs)
  710.     End If
  711.     CzrqText.SetFocus
  712. End Sub
  713. Private Sub CzrqText_KeyDown(KeyCode As Integer, Shift As Integer)    '操作日期帮助
  714.     If KeyCode = vbKeyF2 Then
  715.         Call Czrqbz
  716.     End If
  717. End Sub
  718. Private Function Xtyxxpd() As Boolean                                                   '系统有效性判断
  719.     Xtyxxpd = False
  720.     If Len(Trim(ZtCombo.Text)) = 0 Then
  721.         Tsxx = "公司帐套不能为空,请先建帐套!"
  722.         Call Xtxxts(Tsxx, 0, 1)
  723.         ZtCombo.SetFocus
  724.         Exit Function
  725.     End If
  726.     lsblte = Trim(CzrqText.Text)
  727.     If IsDate(lsblte) Then
  728.         CzrqText.Text = Format(lsblte, "yyyy-mm-dd")
  729.     Else
  730.         Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
  731.         Call Xtxxts(Tsxx, 0, 1)
  732.         Xtyxxpd = False
  733.         CzrqText.SetFocus
  734.         Exit Function
  735.     End If
  736.     If Val(KjyearCombo.Text) <> Val(Mid(CzrqText.Text, 1, 4)) Then
  737.         Tsxx = "所选操作日期与会计年度不一致!"
  738.         Call Xtxxts(Tsxx, 0, 1)
  739.         Xtyxxpd = False
  740.         CzrqText.SetFocus
  741.         Exit Function
  742.     End If
  743.     
  744.     If Trim(CzyCombo.Text) = "" Then
  745.         Tsxx = "用户名不能为空!"
  746.         Call Xtxxts(Tsxx, 0, 1)
  747.         Xtyxxpd = False
  748.         CzyCombo.SetFocus
  749.         Exit Function
  750.     End If
  751.     
  752.     Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl where czybm='" + Trim(Mid(CzyCombo.Text, 1, InStr(1, CzyCombo.Text, "-") - 1)) + "'")
  753.     With Czyrec
  754.         If Not .EOF Then
  755.             If Trim(.Fields("czmm")) <> Mmjm(MmText.Text) Then
  756.                 Tsxx = "操作员密码录入错误!"
  757.                 Call Xtxxts(Tsxx, 0, 1)
  758.                 Xtyxxpd = False
  759.                 MmText.SetFocus
  760.                 Exit Function
  761.             End If
  762.         Else
  763.             Tsxx = "无此操作员!"
  764.             Call Xtxxts(Tsxx, 0, 1)
  765.             Xtyxxpd = False
  766.             CzyCombo.SetFocus
  767.             Exit Function
  768.         End If
  769.    End With
  770.    Xtyxxpd = True
  771. End Function
  772. Private Function Ljyxxpd1() As Boolean                  '数据服务器(帐套当前数据库)连接有效性测试
  773.     Ljyxxpd1 = False
  774.     Xtsjljc = "Provider=SQLOLEDB.1;"
  775.     
  776.     Xtsjljc = Xtsjljc + "Persist Security Info=False;"
  777.     
  778.     Xtsjljc = Xtsjljc + "Data Source=" + Trim(ServerText.Text) + ";"
  779.     
  780.     Xtsjljc = Xtsjljc + " Initial Catalog=" + Ztdqsjk + ";"
  781.     
  782.     On Error GoTo Cwcl
  783.     If Cslj.State = 1 Then Cslj.Close
  784.     Cslj.Open Xtsjljc, "Hxxd", ErpPassWord
  785.     
  786.     Ljyxxpd1 = True
  787.     Exit Function
  788.     
  789. Cwcl:
  790.     Tsxx = "帐套数据库连接失败!"
  791.     Call Xtxxts(Tsxx, 0, 1)
  792.     Exit Function
  793. End Function
  794. Private Sub XgmaCommand_Click()                '修改密码
  795.     If Trim(CzyCombo.Text) = "" Then Exit Sub
  796.     
  797.     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) & "'")
  798.     With Czyrec
  799.         If Not .EOF Then
  800.         CzyCombo.Text = Trim(.Fields("czybm")) + "-" + Trim(.Fields("czymc"))
  801.         Else
  802.             Tsxx = "无此用户名!"
  803.             Call Xtxxts(Tsxx, 0, 1)
  804.             Exit Sub
  805.         End If
  806.     End With
  807.     Czyrec.Close
  808.     Set Czyrec = Nothing
  809.     
  810.     
  811.     With StTab
  812.         .TabEnabled(0) = False
  813.         Frame1(0).Enabled = False
  814.         .TabEnabled(2) = True
  815.         Frame1(2).Enabled = True
  816.         .Tab = 2
  817.     End With
  818.     LrText(0).Text = Trim(MmText.Text)
  819.     LrText(1).Text = ""
  820.     LrText(2).Text = ""
  821.     LrText(0).SetFocus
  822. End Sub
  823. Private Sub MmqdCommand_Click()                '修改密码完毕确定
  824.     With Czyrec
  825.         If .State = 1 Then .Close
  826.         .Open "SELECT * FROM gy_czygl WHERE czybm= '" + Trim(Mid(CzyCombo.Text, 1, InStr(1, CzyCombo.Text, "-") - 1)) + "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  827.         If .EOF Then
  828.             Tsxx = "此操作员已删除!"
  829.             Call Xtxxts(Tsxx, 0, 1)
  830.             Exit Sub
  831.         End If
  832.         If Trim(.Fields("czmm")) <> Mmjm(Trim(LrText(0).Text)) Then
  833.             Tsxx = "输入旧密码错误!"
  834.             Call Xtxxts(Tsxx, 0, 1)
  835.             LrText(0).SetFocus
  836.             Exit Sub
  837.         End If
  838.         If Len(Trim(LrText(1).Text)) = 0 Then
  839.             Tsxx = "操作员密码不能为空!"
  840.             Call Xtxxts(Tsxx, 0, 1)
  841.             LrText(1).SetFocus
  842.             Exit Sub
  843.         End If
  844.         If Trim(LrText(0).Text) = Trim(LrText(1).Text) Then
  845.             Tsxx = "密码没有发生改变!"
  846.             Call Xtxxts(Tsxx, 0, 1)
  847.             LrText(1).SetFocus
  848.             Exit Sub
  849.         End If
  850.         If Trim(LrText(1).Text) <> Trim(LrText(2).Text) Then
  851.             Tsxx = "输入密码与确认密码不一致!"
  852.             Call Xtxxts(Tsxx, 0, 1)
  853.             LrText(1).SetFocus
  854.             Exit Sub
  855.         End If
  856.         .Fields("czmm") = Mmjm(Trim(LrText(1).Text))
  857.         .Fields("xgrq") = Date
  858.         .Update
  859.         MmText.Text = Trim(LrText(1).Text)
  860.         Tsxx = "用户密码修改完毕!"
  861.         Call Xtxxts(Tsxx, 0, 4)
  862.     End With
  863.     With StTab
  864.         .TabEnabled(0) = True
  865.         Frame1(0).Enabled = True
  866.         .TabEnabled(2) = False
  867.         Frame1(2).Enabled = False
  868.         .Tab = 0
  869.     End With
  870. End Sub
  871. Private Sub MmqxCommand_Click()                          '修改密码取消
  872.     With StTab
  873.         .TabEnabled(0) = True
  874.         Frame1(0).Enabled = True
  875.         .TabEnabled(2) = False
  876.         Frame1(2).Enabled = False
  877.         .Tab = 0
  878.     End With
  879. End Sub