上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:30k
源码类别:

企业管理

开发平台:

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