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