上传用户: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      =   2550
  9.    ClientTop       =   2970
  10.    ClientWidth     =   4770
  11.    ControlBox      =   0   'False
  12.    HelpContextID   =   2211001
  13.    Icon            =   "系统_登录窗体.frx":0000
  14.    KeyPreview      =   -1  'True
  15.    LinkTopic       =   "Form2"
  16.    MaxButton       =   0   'False
  17.    MinButton       =   0   'False
  18.    ScaleHeight     =   3765
  19.    ScaleWidth      =   4770
  20.    Begin VB.CheckBox QdCheck 
  21.       Caption         =   "是否修改"
  22.       Height          =   825
  23.       Left            =   4980
  24.       TabIndex        =   11
  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        =   0
  34.       Top             =   390
  35.       Width           =   705
  36.    End
  37.    Begin TabDlg.SSTab StTab 
  38.       Height          =   3705
  39.       Left            =   60
  40.       TabIndex        =   12
  41.       Top             =   30
  42.       Width           =   4665
  43.       _ExtentX        =   8229
  44.       _ExtentY        =   6535
  45.       _Version        =   393216
  46.       Style           =   1
  47.       TabHeight       =   520
  48.       TabCaption(0)   =   "帐套选择及身份验证"
  49.       TabPicture(0)   =   "系统_登录窗体.frx":1042
  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":105E
  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":107A
  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           =   0
  67.          Left            =   90
  68.          TabIndex        =   19
  69.          Top             =   330
  70.          Width           =   4455
  71.          Begin VB.CommandButton QxCommand 
  72.             Caption         =   "取消(&C)"
  73.             Height          =   300
  74.             Left            =   3210
  75.             TabIndex        =   23
  76.             Top             =   2790
  77.             Width           =   1120
  78.          End
  79.          Begin VB.CommandButton QdCommand 
  80.             Caption         =   "确定(&O)"
  81.             Height          =   300
  82.             Left            =   2040
  83.             TabIndex        =   6
  84.             Top             =   2790
  85.             Width           =   1120
  86.          End
  87.          Begin VB.ComboBox ZtCombo 
  88.             Height          =   300
  89.             Left            =   1050
  90.             Style           =   2  'Dropdown List
  91.             TabIndex        =   1
  92.             Top             =   210
  93.             Width           =   3315
  94.          End
  95.          Begin VB.ComboBox KjyearCombo 
  96.             Height          =   300
  97.             Left            =   1050
  98.             Style           =   2  'Dropdown List
  99.             TabIndex        =   2
  100.             Top             =   600
  101.             Width           =   3315
  102.          End
  103.          Begin VB.TextBox CzrqText 
  104.             Height          =   300
  105.             Left            =   1050
  106.             MaxLength       =   10
  107.             TabIndex        =   3
  108.             Top             =   990
  109.             Width           =   2985
  110.          End
  111.          Begin VB.CommandButton Rlcommand 
  112.             CausesValidation=   0   'False
  113.             Height          =   300
  114.             Left            =   4050
  115.             Picture         =   "系统_登录窗体.frx":1096
  116.             Style           =   1  'Graphical
  117.             TabIndex        =   22
  118.             Top             =   990
  119.             Width           =   300
  120.          End
  121.          Begin VB.ComboBox CzyCombo 
  122.             Height          =   300
  123.             Left            =   1050
  124.             TabIndex        =   4
  125.             Top             =   1380
  126.             Width           =   3315
  127.          End
  128.          Begin VB.TextBox MmText 
  129.             Height          =   300
  130.             IMEMode         =   3  'DISABLE
  131.             Left            =   1050
  132.             MaxLength       =   20
  133.             PasswordChar    =   "*"
  134.             TabIndex        =   5
  135.             Top             =   1770
  136.             Width           =   2730
  137.          End
  138.          Begin VB.Timer Timer1 
  139.             Interval        =   100
  140.             Left            =   420
  141.             Top             =   2550
  142.          End
  143.          Begin VB.CommandButton XgmaCommand 
  144.             Caption         =   "修改密码(&M)"
  145.             Height          =   300
  146.             Left            =   2040
  147.             TabIndex        =   21
  148.             Top             =   2430
  149.             Width           =   1120
  150.          End
  151.          Begin VB.CommandButton GgszCommand 
  152.             Caption         =   "更改设置(&A)"
  153.             Height          =   300
  154.             Left            =   3210
  155.             TabIndex        =   20
  156.             Top             =   2430
  157.             Width           =   1120
  158.          End
  159.          Begin VB.Label TsLabel 
  160.             Alignment       =   1  'Right Justify
  161.             Caption         =   "操作日期:"
  162.             Height          =   345
  163.             Index           =   3
  164.             Left            =   150
  165.             TabIndex        =   28
  166.             Top             =   1050
  167.             Width           =   825
  168.          End
  169.          Begin VB.Label TsLabel 
  170.             Alignment       =   1  'Right Justify
  171.             Caption         =   "会计年度:"
  172.             Height          =   345
  173.             Index           =   1
  174.             Left            =   150
  175.             TabIndex        =   27
  176.             Top             =   660
  177.             Width           =   825
  178.          End
  179.          Begin VB.Label TsLabel 
  180.             Alignment       =   1  'Right Justify
  181.             Caption         =   "公司帐套:"
  182.             Height          =   255
  183.             Index           =   0
  184.             Left            =   120
  185.             TabIndex        =   26
  186.             Top             =   270
  187.             Width           =   855
  188.          End
  189.          Begin VB.Label TsLabel 
  190.             Alignment       =   1  'Right Justify
  191.             AutoSize        =   -1  'True
  192.             Caption         =   "用户名:"
  193.             Height          =   180
  194.             Index           =   2
  195.             Left            =   165
  196.             TabIndex        =   25
  197.             Top             =   1410
  198.             Width           =   630
  199.          End
  200.          Begin VB.Label TsLabel 
  201.             Caption         =   "密码:"
  202.             Height          =   345
  203.             Index           =   4
  204.             Left            =   180
  205.             TabIndex        =   24
  206.             Top             =   1830
  207.             Width           =   585
  208.          End
  209.          Begin VB.Line Line1 
  210.             Index           =   0
  211.             X1              =   180
  212.             X2              =   4320
  213.             Y1              =   2280
  214.             Y2              =   2280
  215.          End
  216.          Begin VB.Line Line1 
  217.             BorderColor     =   &H00FFFFFF&
  218.             Index           =   1
  219.             X1              =   180
  220.             X2              =   4320
  221.             Y1              =   2310
  222.             Y2              =   2310
  223.          End
  224.          Begin VB.Image Image1 
  225.             Height          =   480
  226.             Left            =   3870
  227.             Picture         =   "系统_登录窗体.frx":1420
  228.             Top             =   1740
  229.             Width           =   480
  230.          End
  231.       End
  232.       Begin VB.Frame Frame1 
  233.          Height          =   3255
  234.          Index           =   1
  235.          Left            =   -74910
  236.          TabIndex        =   18
  237.          Top             =   330
  238.          Width           =   4455
  239.          Begin VB.CommandButton LjqxCommand 
  240.             Caption         =   "取 消"
  241.             Height          =   300
  242.             Left            =   2580
  243.             TabIndex        =   31
  244.             Top             =   1440
  245.             Width           =   1120
  246.          End
  247.          Begin VB.CommandButton LjqdCommand 
  248.             Caption         =   "确 定"
  249.             Height          =   300
  250.             Left            =   1410
  251.             TabIndex        =   30
  252.             Top             =   1440
  253.             Width           =   1120
  254.          End
  255.          Begin VB.TextBox ServerText 
  256.             Height          =   300
  257.             Left            =   1800
  258.             TabIndex        =   29
  259.             Top             =   660
  260.             Width           =   1905
  261.          End
  262.          Begin MSComCtl2.Animation Animation1 
  263.             Height          =   615
  264.             Left            =   150
  265.             TabIndex        =   32
  266.             Top             =   1290
  267.             Visible         =   0   'False
  268.             Width           =   705
  269.             _ExtentX        =   1244
  270.             _ExtentY        =   1085
  271.             _Version        =   393216
  272.             Center          =   -1  'True
  273.             BackStyle       =   1
  274.             FullWidth       =   47
  275.             FullHeight      =   41
  276.          End
  277.          Begin VB.Label DdtsLabel 
  278.             ForeColor       =   &H00FF0000&
  279.             Height          =   255
  280.             Left            =   1110
  281.             TabIndex        =   34
  282.             Top             =   2490
  283.             Width           =   3045
  284.          End
  285.          Begin VB.Label TsLabel 
  286.             Alignment       =   1  'Right Justify
  287.             AutoSize        =   -1  'True
  288.             Caption         =   "数据服务器:"
  289.             Height          =   180
  290.             Index           =   7
  291.             Left            =   765
  292.             TabIndex        =   33
  293.             Top             =   720
  294.             Width           =   990
  295.          End
  296.       End
  297.       Begin VB.Frame Frame1 
  298.          Height          =   3255
  299.          Index           =   2
  300.          Left            =   -74910
  301.          TabIndex        =   13
  302.          Top             =   330
  303.          Width           =   4455
  304.          Begin VB.TextBox LrText 
  305.             Height          =   300
  306.             IMEMode         =   3  'DISABLE
  307.             Index           =   0
  308.             Left            =   1110
  309.             MaxLength       =   20
  310.             PasswordChar    =   "*"
  311.             TabIndex        =   7
  312.             Top             =   420
  313.             Width           =   3210
  314.          End
  315.          Begin VB.CommandButton MmqdCommand 
  316.             Caption         =   "确定(&O)"
  317.             Height          =   300
  318.             Left            =   1110
  319.             TabIndex        =   10
  320.             Top             =   2160
  321.             Width           =   1120
  322.          End
  323.          Begin VB.CommandButton MmqxCommand 
  324.             Caption         =   "取消(&C)"
  325.             Height          =   300
  326.             Left            =   2280
  327.             TabIndex        =   14
  328.             Top             =   2160
  329.             Width           =   1125
  330.          End
  331.          Begin VB.TextBox LrText 
  332.             Height          =   300
  333.             IMEMode         =   3  'DISABLE
  334.             Index           =   1
  335.             Left            =   1110
  336.             MaxLength       =   20
  337.             PasswordChar    =   "*"
  338.             TabIndex        =   8
  339.             Top             =   810
  340.             Width           =   3210
  341.          End
  342.          Begin VB.TextBox LrText 
  343.             Height          =   300
  344.             IMEMode         =   3  'DISABLE
  345.             Index           =   2
  346.             Left            =   1110
  347.             MaxLength       =   20
  348.             PasswordChar    =   "*"
  349.             TabIndex        =   9
  350.             Top             =   1200
  351.             Width           =   3210
  352.          End
  353.          Begin VB.Line Line1 
  354.             Index           =   2
  355.             X1              =   240
  356.             X2              =   4290
  357.             Y1              =   1770
  358.             Y2              =   1770
  359.          End
  360.          Begin VB.Label TsLabel 
  361.             AutoSize        =   -1  'True
  362.             Caption         =   "旧密码:"
  363.             Height          =   180
  364.             Index           =   14
  365.             Left            =   240
  366.             TabIndex        =   17
  367.             Top             =   480
  368.             Width           =   630
  369.          End
  370.          Begin VB.Label TsLabel 
  371.             AutoSize        =   -1  'True
  372.             Caption         =   "新密码:"
  373.             Height          =   180
  374.             Index           =   15
  375.             Left            =   240
  376.             TabIndex        =   16
  377.             Top             =   870
  378.             Width           =   630
  379.          End
  380.          Begin VB.Label TsLabel 
  381.             AutoSize        =   -1  'True
  382.             Caption         =   "确认密码:"
  383.             Height          =   180
  384.             Index           =   16
  385.             Left            =   240
  386.             TabIndex        =   15
  387.             Top             =   1260
  388.             Width           =   810
  389.          End
  390.          Begin VB.Line Line1 
  391.             BorderColor     =   &H00FFFFFF&
  392.             Index           =   3
  393.             X1              =   240
  394.             X2              =   4260
  395.             Y1              =   1800
  396.             Y2              =   1800
  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 = 20
  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 = "22%"         '子系统菜单系统代号
  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.     
  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='22'")
  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 pmjzbz=0 order by kjyear DESC,period ")
  691.     If Not Xtrlrec.EOF Then
  692.         KjyearCombo.Text = Xtrlrec.Fields("Kjyear")
  693.     End If
  694.     
  695.     'by tjx
  696.     '读入当前会计日期
  697.     Call CurrPeriod
  698.     
  699.     Call Drxtztcs             '读入系统帐套参数
  700.   
  701.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select ServerDate=getdate()")
  702.     CzrqText = Format(RecTemp.Fields("ServerDate"), "yyyy-mm-dd")
  703.    
  704. ErrHandle:
  705.    
  706. End Sub
  707. Private Sub Czrqbz()                                                  '操作日期帮助
  708.     Xtcdcs = Trim(CzrqText.Text)
  709.     Xtfhcs = ""
  710.     XT_calendar.Show 1
  711.     If Xtfhcs <> "" Then
  712.         CzrqText.Text = Trim(Xtfhcs)
  713.     End If
  714.     CzrqText.SetFocus
  715. End Sub
  716. Private Sub CzrqText_KeyDown(KeyCode As Integer, Shift As Integer)    '操作日期帮助
  717.     If KeyCode = vbKeyF2 Then
  718.         Call Czrqbz
  719.     End If
  720. End Sub
  721. Private Function Xtyxxpd() As Boolean                                                   '系统有效性判断
  722.     Xtyxxpd = False
  723.     If Len(Trim(ZtCombo.Text)) = 0 Then
  724.         Tsxx = "公司帐套不能为空,请先建帐套!"
  725.         Call Xtxxts(Tsxx, 0, 1)
  726.         ZtCombo.SetFocus
  727.         Exit Function
  728.     End If
  729.     lsblte = Trim(CzrqText.Text)
  730.     If IsDate(lsblte) Then
  731.         CzrqText.Text = Format(lsblte, "yyyy-mm-dd")
  732.     Else
  733.         Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
  734.         Call Xtxxts(Tsxx, 0, 1)
  735.         Xtyxxpd = False
  736.         CzrqText.SetFocus
  737.         Exit Function
  738.     End If
  739.     If Val(KjyearCombo.Text) <> Val(Mid(CzrqText.Text, 1, 4)) Then
  740.         Tsxx = "所选操作日期与会计年度不一致!"
  741.         Call Xtxxts(Tsxx, 0, 1)
  742.         Xtyxxpd = False
  743.         CzrqText.SetFocus
  744.         Exit Function
  745.     End If
  746.     
  747.     If Trim(CzyCombo.Text) = "" Then
  748.         Tsxx = "用户名不能为空!"
  749.         Call Xtxxts(Tsxx, 0, 1)
  750.         Xtyxxpd = False
  751.         CzyCombo.SetFocus
  752.         Exit Function
  753.     End If
  754.     
  755.     Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl where czybm='" + Trim(Mid(CzyCombo.Text, 1, InStr(1, CzyCombo.Text, "-") - 1)) + "'")
  756.     With Czyrec
  757.         If Not .EOF Then
  758.             If Trim(.Fields("czmm")) <> Mmjm(MmText.Text) Then
  759.                 Tsxx = "操作员密码录入错误!"
  760.                 Call Xtxxts(Tsxx, 0, 1)
  761.                 Xtyxxpd = False
  762.                 MmText.SetFocus
  763.                 Exit Function
  764.             End If
  765.         Else
  766.             Tsxx = "无此操作员!"
  767.             Call Xtxxts(Tsxx, 0, 1)
  768.             Xtyxxpd = False
  769.             CzyCombo.SetFocus
  770.             Exit Function
  771.         End If
  772.    End With
  773.    Xtyxxpd = True
  774. End Function
  775. Private Function Ljyxxpd1() As Boolean                  '数据服务器(帐套当前数据库)连接有效性测试
  776.     Ljyxxpd1 = False
  777.     Xtsjljc = "Provider=SQLOLEDB.1;"
  778.     
  779.     Xtsjljc = Xtsjljc + "Persist Security Info=False;"
  780.     
  781.     Xtsjljc = Xtsjljc + "Data Source=" + Trim(ServerText.Text) + ";"
  782.     
  783.     Xtsjljc = Xtsjljc + " Initial Catalog=" + Ztdqsjk + ";"
  784.     
  785.     On Error GoTo Cwcl
  786.     If Cslj.State = 1 Then Cslj.Close
  787.     Cslj.Open Xtsjljc, "Hxxd", ErpPassWord
  788.     
  789.     Ljyxxpd1 = True
  790.     Exit Function
  791.     
  792. Cwcl:
  793.     Tsxx = "帐套数据库连接失败!"
  794.     Call Xtxxts(Tsxx, 0, 1)
  795.     Exit Function
  796. End Function
  797. Private Sub XgmaCommand_Click()                '修改密码
  798.     If Trim(CzyCombo.Text) = "" Then Exit Sub
  799.     
  800.     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) & "'")
  801.     With Czyrec
  802.         If Not .EOF Then
  803.         CzyCombo.Text = Trim(.Fields("czybm")) + "-" + Trim(.Fields("czymc"))
  804.         Else
  805.             Tsxx = "无此用户名!"
  806.             Call Xtxxts(Tsxx, 0, 1)
  807.             Exit Sub
  808.         End If
  809.     End With
  810.     Czyrec.Close
  811.     Set Czyrec = Nothing
  812.     
  813.     
  814.     With StTab
  815.         .TabEnabled(0) = False
  816.         Frame1(0).Enabled = False
  817.         .TabEnabled(2) = True
  818.         Frame1(2).Enabled = True
  819.         .Tab = 2
  820.     End With
  821.     LrText(0).Text = Trim(MmText.Text)
  822.     LrText(1).Text = ""
  823.     LrText(2).Text = ""
  824.     LrText(0).SetFocus
  825. End Sub
  826. Private Sub MmqdCommand_Click()                '修改密码完毕确定
  827.     With Czyrec
  828.         If .State = 1 Then .Close
  829.         .Open "SELECT * FROM gy_czygl WHERE czybm= '" + Trim(Mid(CzyCombo.Text, 1, InStr(1, CzyCombo.Text, "-") - 1)) + "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  830.         If .EOF Then
  831.             Tsxx = "此操作员已删除!"
  832.             Call Xtxxts(Tsxx, 0, 1)
  833.             Exit Sub
  834.         End If
  835.         If Trim(.Fields("czmm")) <> Mmjm(Trim(LrText(0).Text)) Then
  836.             Tsxx = "输入旧密码错误!"
  837.             Call Xtxxts(Tsxx, 0, 1)
  838.             LrText(0).SetFocus
  839.             Exit Sub
  840.         End If
  841.         If Len(Trim(LrText(1).Text)) = 0 Then
  842.             Tsxx = "操作员密码不能为空!"
  843.             Call Xtxxts(Tsxx, 0, 1)
  844.             LrText(1).SetFocus
  845.             Exit Sub
  846.         End If
  847.         If Trim(LrText(0).Text) = Trim(LrText(1).Text) Then
  848.             Tsxx = "密码没有发生改变!"
  849.             Call Xtxxts(Tsxx, 0, 1)
  850.             LrText(1).SetFocus
  851.             Exit Sub
  852.         End If
  853.         If Trim(LrText(1).Text) <> Trim(LrText(2).Text) Then
  854.             Tsxx = "输入密码与确认密码不一致!"
  855.             Call Xtxxts(Tsxx, 0, 1)
  856.             LrText(1).SetFocus
  857.             Exit Sub
  858.         End If
  859.         .Fields("czmm") = Mmjm(Trim(LrText(1).Text))
  860.         .Fields("xgrq") = Date
  861.         .Update
  862.         MmText.Text = Trim(LrText(1).Text)
  863.         Tsxx = "用户密码修改完毕!"
  864.         Call Xtxxts(Tsxx, 0, 4)
  865.     End With
  866.     With StTab
  867.         .TabEnabled(0) = True
  868.         Frame1(0).Enabled = True
  869.         .TabEnabled(2) = False
  870.         Frame1(2).Enabled = False
  871.         .Tab = 0
  872.     End With
  873. End Sub
  874. Private Sub MmqxCommand_Click()                          '修改密码取消
  875.     With StTab
  876.         .TabEnabled(0) = True
  877.         Frame1(0).Enabled = True
  878.         .TabEnabled(2) = False
  879.         Frame1(2).Enabled = False
  880.         .Tab = 0
  881.     End With
  882. End Sub