上传用户: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      =   4035
  9.    ClientTop       =   3300
  10.    ClientWidth     =   4770
  11.    ControlBox      =   0   'False
  12.    HelpContextID   =   1100001
  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":0000
  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":001C
  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":0038
  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":0054
  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":03DE
  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. Dim Xtsjljc As String                       '系统数据服务器连接串
  406. Dim ErpPassWord As String                   '系统连接密码
  407. Dim Cslj As New ADODB.Connection            '测试连接(为屏蔽提示信息)
  408. Dim Tsxx As String                          '系统提示信息
  409. Dim Czyrec As New ADODB.Recordset           '操作员动态集
  410. Dim Xtrlrec As New ADODB.Recordset          '系统日历动态集
  411. Dim Ztdqsjk As String                       '所选帐套当前数据库
  412. Private Function Ljyxxpd() As Boolean       '数据服务器(系统基本信息库)连接有效性测试
  413.     Ljyxxpd = False
  414.     If Len(Trim(ServerText.Text)) = 0 Then
  415.         Tsxx = "数据服务器名不能为空!"
  416.         Call Xtxxts(Tsxx, 0, 1)
  417.         ServerText.SetFocus
  418.         Exit Function
  419.     End If
  420.     Xtsjljc = "Provider=SQLOLEDB.1;"
  421.     
  422.     Xtsjljc = Xtsjljc + "Persist Security Info=False;"
  423.     
  424.     Xtsjljc = Xtsjljc + "Data Source=" + Trim(ServerText.Text) + ";"
  425.     
  426.     Xtsjljc = Xtsjljc + " Initial Catalog=" + "Master" + ";"
  427.     
  428.     If Cslj.State = 1 Then Cslj.Close
  429.     
  430.     DdtsLabel = "系统正在连接数据服务器,请稍等..."
  431.     DdtsLabel.Refresh
  432.     With Me.Animation1
  433.         .Visible = True
  434.         .Open App.Path + "Ljcs.avi"
  435.         .Play
  436.     End With
  437.     On Error GoTo Cwcl
  438.     
  439.     If Cslj.State = 1 Then Cslj.Close
  440.     Cslj.Open Xtsjljc, "Hxxd", ErpPassWord
  441.     
  442.     Animation1.Stop
  443.     Animation1.Visible = False
  444.     
  445.     DdtsLabel = ""
  446.     DdtsLabel.Refresh
  447.       
  448.     Ljyxxpd = True
  449.     
  450.     Exit Function
  451.     
  452. Cwcl:
  453.     Animation1.Visible = False
  454.     Animation1.Stop
  455.     DdtsLabel = ""
  456.     Tsxx = "数据服务器连接测试失败!"
  457.     Call Xtxxts(Tsxx, 0, 1)
  458.     Exit Function
  459.   
  460. End Function
  461. Private Sub CzrqText_KeyPress(KeyAscii As Integer)      '录入日期限制
  462.     Call Lrrqxz(KeyAscii)
  463. End Sub
  464. Private Sub Form_KeyPress(KeyAscii As Integer)          '控 制 焦 点 转 移
  465.     Dim jdzygs As Integer
  466.     jdzygs = 12
  467.     Select Case KeyAscii
  468.         Case vbKeyReturn
  469.             If Kjjdzy(jdzygs) Then
  470.                 KeyAscii = 0
  471.             End If
  472.         Case 39           '屏蔽"'"
  473.             KeyAscii = 0
  474.     End Select
  475. End Sub
  476. Private Sub Form_Load()
  477.     App.HelpFile = App.Path + "采购系统.chm"
  478.     
  479.     XtMenuList = "11%"         '子系统菜单系统代号
  480.     
  481.     ErpPassWord = "123"
  482.     
  483.     Call Qcljnr     '读入连接内容
  484.     
  485.     With StTab
  486.         .TabEnabled(0) = False
  487.         Frame1(0).Enabled = False
  488.         .TabEnabled(1) = True
  489.         Frame1(1).Enabled = True
  490.         .TabEnabled(2) = False
  491.         Frame1(2).Enabled = False
  492.          StTab.Tab = 1
  493.     End With
  494.     
  495. End Sub
  496. Private Sub GgszCommand_Click()
  497.     With Me.StTab
  498.         .TabEnabled(0) = False
  499.         Frame1(0).Enabled = False
  500.         .TabEnabled(1) = True
  501.         Frame1(1).Enabled = True
  502.         .Tab = 1
  503.     End With
  504.     
  505.     ' 让数据服务器设置文本框得到焦点
  506.     ServerText.SetFocus
  507.     ServerText.SelStart = 0
  508.     ServerText.SelLength = Len(ServerText.Text)
  509. End Sub
  510. Private Sub LjqdCommand_Click()                              '保 存 设 置
  511.  
  512.     If Ljyxxpd Then
  513.         If Cw_DataEnvi.BaseInfoConnect.State = 1 Then Cw_DataEnvi.BaseInfoConnect.Close
  514.         Cw_DataEnvi.BaseInfoConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  515.         
  516.         Tsxx = "连接测试成功!"
  517.         Call Xtxxts(Tsxx, 0, 4)
  518.         
  519.         StTab.TabEnabled(1) = False
  520.         Frame1(1).Enabled = False
  521.         StTab.TabEnabled(0) = True
  522.         Frame1(0).Enabled = True
  523.         StTab.Tab = 0
  524.         Call Tcztxx
  525.         
  526.         If ZtCombo.ListCount > 0 Then
  527.             ZtCombo.ListIndex = 0
  528.         End If
  529.     End If
  530. End Sub
  531. Private Sub Qcljnr()                                         '取 出 数 据
  532.     On Error Resume Next
  533.     Dim int_Count As Integer
  534.     
  535.     ServerText.Text = ReadOneString("Option", "SqlServer", "localhost")
  536.     str_Account = ReadOneString("Option", "Account", "")
  537.     
  538.     For int_Count = 0 To ZtCombo.ListCount - 1
  539.         If UCase(Mid(ZtCombo.List(int_Count), 1, InStr(ZtCombo.List(int_Count), "-") - 1)) = UCase(Mid(str_Account, 1, InStr(str_Account, "-") - 1)) Then
  540.             ZtCombo.ListIndex = int_Count
  541.         End If
  542.     Next int_Count
  543. End Sub
  544. Private Sub QdCommand_Click()          '确定进入系统
  545.     If Trim(CzyCombo.Text) = "" Then Exit Sub
  546.     
  547.     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) & "'")
  548.     With Czyrec
  549.         If Not .EOF Then
  550.         CzyCombo.Text = Trim(.Fields("czybm")) + "-" + Trim(.Fields("czymc"))
  551.         Else
  552.             Tsxx = "无此用户名!"
  553.             Call Xtxxts(Tsxx, 0, 1)
  554.             Exit Sub
  555.         End If
  556.     End With
  557.     Czyrec.Close
  558.     Set Czyrec = Nothing
  559.     If Xtyxxpd Then
  560.         If Ljyxxpd1 Then
  561.             If Cw_DataEnvi.DataConnect.State = 1 Then Cw_DataEnvi.DataConnect.Close
  562.             Cw_DataEnvi.DataConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  563.         End If
  564.         QdCheck.Value = 1
  565.         Me.Hide
  566.         
  567.         Call WriteOneString("Option", "SqlServer", Trim(ServerText.Text))
  568.         Call WriteOneString("Option", "Account", Trim(ZtCombo.Text))
  569.         
  570.         CtdrCheck.Value = 1
  571.         GgszCommand.Enabled = False
  572.         XT_Main.Show
  573.         
  574.         Xt_Control.tvTreeView.Visible = False
  575.         Xt_Control.tvTreeView.Nodes.Clear
  576.         Xt_Control.Cshgns
  577.         Xt_Control.tvTreeView.Refresh
  578.         Xt_Control.tvTreeView.Visible = True
  579.     End If
  580. End Sub
  581. Private Sub QxCommand_Click()                                     '取消进入系统
  582.     If CtdrCheck.Value <> 1 Then
  583.         Unload Me
  584.     Else
  585.         Me.Hide
  586.     End If
  587. End Sub
  588. Private Sub Rlcommand_Click()                                     '操作日期帮助
  589.     Call Czrqbz
  590. End Sub
  591. Private Sub Timer1_Timer()                                        '激活连接测试
  592.     Timer1.Enabled = False
  593.     
  594.     If Ljyxxpd Then
  595.         If Cw_DataEnvi.BaseInfoConnect.State = 1 Then Cw_DataEnvi.BaseInfoConnect.Close
  596.         Cw_DataEnvi.BaseInfoConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  597.     Else
  598.         Exit Sub
  599.     End If
  600.     
  601.     With StTab
  602.         .TabEnabled(1) = False
  603.         Frame1(1).Enabled = False
  604.         .TabEnabled(0) = True
  605.         Frame1(0).Enabled = True
  606.     End With
  607.     
  608.     StTab.Tab = 0
  609.       
  610.     Call Tcztxx
  611.     Qcljnr
  612.     
  613.     '让用户名录入框得到焦点
  614.     CzyCombo.SetFocus
  615. End Sub
  616. Private Sub LjqxCommand_Click()                                   '连接失败退出
  617.     If CtdrCheck.Value <> 1 Then
  618.         Unload Me
  619.     Else
  620.         Me.Hide
  621.     End If
  622. End Sub
  623. Private Sub Tcztxx()                                              '填充帐套信息选择
  624.     Dim Xtztxxrec As New ADODB.Recordset        '系统帐套信息动态集
  625.     Set Xtztxxrec = Cw_DataEnvi.BaseInfoConnect.Execute("Select * From HDSystem_Databases order by number")
  626.     ZtCombo.Clear
  627.     With Xtztxxrec
  628.         Do While Not .EOF
  629.             If .Fields("YNuse") = "1" Then
  630.                 ZtCombo.AddItem .Fields("number") + "-" + Trim(.Fields("CountingRoomName"))
  631.             End If
  632.             .MoveNext
  633.         Loop
  634.     End With
  635. End Sub
  636. Private Sub ZtCombo_Click()
  637.     Dim Xtztxxrec As New ADODB.Recordset        '系统帐套信息动态集
  638.     Dim RecTemp As New ADODB.Recordset
  639.     Dim Xt_Id As Integer                         '该模块系统的ID号
  640.     
  641.     On Error GoTo ErrHandle
  642.     Set Xtztxxrec = Cw_DataEnvi.BaseInfoConnect.Execute("Select * From HDSystem_DataBases where Number='" + Trim(Mid(ZtCombo.Text, 1, InStr(1, ZtCombo.Text, "-") - 1)) + "'")
  643.     With Xtztxxrec
  644.         If Not .EOF Then
  645.             Ztdqsjk = Trim(.Fields("DataBasesName"))
  646.         End If
  647.     End With
  648.     If Ljyxxpd1 Then
  649.         If Cw_DataEnvi.DataConnect.State = 1 Then Cw_DataEnvi.DataConnect.Close
  650.         Cw_DataEnvi.DataConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  651.     Else
  652.         Exit Sub
  653.     End If
  654.    
  655.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select ID From Xt_Xtgnb  Where gnbm='11'")
  656.     If RecTemp.EOF = False Then
  657.         Xt_Id = RecTemp.Fields("ID")
  658.         Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl Where  right(left(AuthorityId," & Xt_Id & "),1)='1' order by czybm")
  659.         XgmaCommand.Enabled = True
  660.         QdCommand.Enabled = True
  661.         CzyCombo.Enabled = True
  662.     Else
  663.         XgmaCommand.Enabled = False
  664.         QdCommand.Enabled = False
  665.         CzyCombo.Text = ""
  666.         CzyCombo.Enabled = False
  667.         Tsxx = "请将该系统的操作权限赋予操作员!"
  668.         Call Xtxxts(Tsxx, 0, 4)
  669.         Exit Sub
  670.     End If
  671.     Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl order by czybm")
  672.     CzyCombo.Clear
  673.     With Czyrec
  674.         Do While Not .EOF
  675.             CzyCombo.AddItem Trim(.Fields("czybm")) + "-" + Trim(.Fields("czymc"))
  676.             .MoveNext
  677.         Loop
  678.         CzyCombo.Text = CzyCombo.List(0)
  679.     End With
  680.     Set Xtrlrec = Cw_DataEnvi.DataConnect.Execute("Select distinct kjyear From gy_kjrlb order by kjyear ")
  681.     KjyearCombo.Clear
  682.     With Xtrlrec
  683.         Do While Not .EOF
  684.            KjyearCombo.AddItem Trim(.Fields("kjyear"))
  685.            .MoveNext
  686.         Loop
  687.     End With
  688.     
  689.     Set Xtrlrec = Cw_DataEnvi.DataConnect.Execute("Select top 1 kjyear From gy_kjrlb where cgjzbz=0 order by kjyear DESC,period ")
  690.     If Not Xtrlrec.EOF Then
  691.         KjyearCombo.Text = Xtrlrec.Fields("Kjyear")
  692.     End If
  693.    
  694.     Call Drxtztcs             '读入系统帐套参数
  695.   
  696.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select ServerDate=getdate()")
  697.     CzrqText = Format(RecTemp.Fields("ServerDate"), "yyyy-mm-dd")
  698.    
  699. ErrHandle:
  700.    
  701. End Sub
  702. Private Sub Czrqbz()                                                  '操作日期帮助
  703.     Xtcdcs = Trim(CzrqText.Text)
  704.     Xtfhcs = ""
  705.     XT_calendar.Show 1
  706.     If Xtfhcs <> "" Then
  707.         CzrqText.Text = Trim(Xtfhcs)
  708.     End If
  709.     CzrqText.SetFocus
  710. End Sub
  711. Private Sub CzrqText_KeyDown(KeyCode As Integer, Shift As Integer)    '操作日期帮助
  712.     If KeyCode = vbKeyF2 Then
  713.         Call Czrqbz
  714.     End If
  715. End Sub
  716. Private Function Xtyxxpd() As Boolean                                                   '系统有效性判断
  717.     Xtyxxpd = False
  718.     If Len(Trim(ZtCombo.Text)) = 0 Then
  719.         Tsxx = "公司帐套不能为空,请先建帐套!"
  720.         Call Xtxxts(Tsxx, 0, 1)
  721.         ZtCombo.SetFocus
  722.         Exit Function
  723.     End If
  724.     lsblte = Trim(CzrqText.Text)
  725.     If IsDate(lsblte) Then
  726.         CzrqText.Text = Format(lsblte, "yyyy-mm-dd")
  727.     Else
  728.         Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
  729.         Call Xtxxts(Tsxx, 0, 1)
  730.         Xtyxxpd = False
  731.         CzrqText.SetFocus
  732.         Exit Function
  733.     End If
  734.     If S2N(KjyearCombo.Text) <> S2N(Mid(CzrqText.Text, 1, 4)) Then
  735.         Tsxx = "所选操作日期与会计年度不一致!"
  736.         Call Xtxxts(Tsxx, 0, 1)
  737.         Xtyxxpd = False
  738.         CzrqText.SetFocus
  739.         Exit Function
  740.     End If
  741.     
  742.     If Trim(CzyCombo.Text) = "" Then
  743.         Tsxx = "用户名不能为空!"
  744.         Call Xtxxts(Tsxx, 0, 1)
  745.         Xtyxxpd = False
  746.         CzyCombo.SetFocus
  747.         Exit Function
  748.     End If
  749.     
  750.     Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl where czybm='" + Trim(Mid(CzyCombo.Text, 1, InStr(1, CzyCombo.Text, "-") - 1)) + "'")
  751.     With Czyrec
  752.         If Not .EOF Then
  753.             If Trim(.Fields("czmm")) <> Mmjm(MmText.Text) Then
  754.                 Tsxx = "操作员密码录入错误!"
  755.                 Call Xtxxts(Tsxx, 0, 1)
  756.                 Xtyxxpd = False
  757.                 MmText.SetFocus
  758.                 Exit Function
  759.             End If
  760.         Else
  761.             Tsxx = "无此操作员!"
  762.             Call Xtxxts(Tsxx, 0, 1)
  763.             Xtyxxpd = False
  764.             CzyCombo.SetFocus
  765.             Exit Function
  766.         End If
  767.    End With
  768.    Xtyxxpd = True
  769. End Function
  770. Private Function Ljyxxpd1() As Boolean                  '数据服务器(帐套当前数据库)连接有效性测试
  771.     Ljyxxpd1 = False
  772.     Xtsjljc = "Provider=SQLOLEDB.1;"
  773.     
  774.     Xtsjljc = Xtsjljc + "Persist Security Info=False;"
  775.     
  776.     Xtsjljc = Xtsjljc + "Data Source=" + Trim(ServerText.Text) + ";"
  777.     
  778.     Xtsjljc = Xtsjljc + " Initial Catalog=" + Ztdqsjk + ";"
  779.     
  780.     On Error GoTo Cwcl
  781.     If Cslj.State = 1 Then Cslj.Close
  782.     Cslj.Open Xtsjljc, "Hxxd", ErpPassWord
  783.     
  784.     Ljyxxpd1 = True
  785.     Exit Function
  786.     
  787. Cwcl:
  788.     Tsxx = "帐套数据库连接失败!"
  789.     Call Xtxxts(Tsxx, 0, 1)
  790.     Exit Function
  791. End Function
  792. Private Sub XgmaCommand_Click()                '修改密码
  793.     If Trim(CzyCombo.Text) = "" Then Exit Sub
  794.     
  795.     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) & "'")
  796.     With Czyrec
  797.         If Not .EOF Then
  798.         CzyCombo.Text = Trim(.Fields("czybm")) + "-" + Trim(.Fields("czymc"))
  799.         Else
  800.             Tsxx = "无此用户名!"
  801.             Call Xtxxts(Tsxx, 0, 1)
  802.             Exit Sub
  803.         End If
  804.     End With
  805.     Czyrec.Close
  806.     Set Czyrec = Nothing
  807.     
  808.     
  809.     With StTab
  810.         .TabEnabled(0) = False
  811.         Frame1(0).Enabled = False
  812.         .TabEnabled(2) = True
  813.         Frame1(2).Enabled = True
  814.         .Tab = 2
  815.     End With
  816.     LrText(0).Text = Trim(MmText.Text)
  817.     LrText(1).Text = ""
  818.     LrText(2).Text = ""
  819.     LrText(0).SetFocus
  820. End Sub
  821. Private Sub MmqdCommand_Click()                '修改密码完毕确定
  822.     With Czyrec
  823.         If .State = 1 Then .Close
  824.         .Open "SELECT * FROM gy_czygl WHERE czybm= '" + Trim(Mid(CzyCombo.Text, 1, InStr(1, CzyCombo.Text, "-") - 1)) + "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  825.         If .EOF Then
  826.             Tsxx = "此操作员已删除!"
  827.             Call Xtxxts(Tsxx, 0, 1)
  828.             Exit Sub
  829.         End If
  830.         If Trim(.Fields("czmm")) <> Mmjm(Trim(LrText(0).Text)) Then
  831.             Tsxx = "输入旧密码错误!"
  832.             Call Xtxxts(Tsxx, 0, 1)
  833.             LrText(0).SetFocus
  834.             Exit Sub
  835.         End If
  836.         If Len(Trim(LrText(1).Text)) = 0 Then
  837.             Tsxx = "操作员密码不能为空!"
  838.             Call Xtxxts(Tsxx, 0, 1)
  839.             LrText(1).SetFocus
  840.             Exit Sub
  841.         End If
  842.         If Trim(LrText(0).Text) = Trim(LrText(1).Text) Then
  843.             Tsxx = "密码没有发生改变!"
  844.             Call Xtxxts(Tsxx, 0, 1)
  845.             LrText(1).SetFocus
  846.             Exit Sub
  847.         End If
  848.         If Trim(LrText(1).Text) <> Trim(LrText(2).Text) Then
  849.             Tsxx = "输入密码与确认密码不一致!"
  850.             Call Xtxxts(Tsxx, 0, 1)
  851.             LrText(1).SetFocus
  852.             Exit Sub
  853.         End If
  854.         .Fields("czmm") = Mmjm(Trim(LrText(1).Text))
  855.         .Fields("xgrq") = Date
  856.         .Update
  857.         MmText.Text = Trim(LrText(1).Text)
  858.         Tsxx = "用户密码修改完毕!"
  859.         Call Xtxxts(Tsxx, 0, 4)
  860.     End With
  861.     With StTab
  862.         .TabEnabled(0) = True
  863.         Frame1(0).Enabled = True
  864.         .TabEnabled(2) = False
  865.         Frame1(2).Enabled = False
  866.         .Tab = 0
  867.     End With
  868. End Sub
  869. Private Sub MmqxCommand_Click()                          '修改密码取消
  870.     With StTab
  871.         .TabEnabled(0) = True
  872.         Frame1(0).Enabled = True
  873.         .TabEnabled(2) = False
  874.         Frame1(2).Enabled = False
  875.         .Tab = 0
  876.     End With
  877. End Sub