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