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