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