⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmselectstdvoucher.frm

📁 金算盘软件代码
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{F6125AB1-8AB1-11CE-A77F-08002B2F4E98}#2.0#0"; "MSRDC20.OCX"
Begin VB.Form frmSelectStdVoucher 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "选择样板凭证"
   ClientHeight    =   5070
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6300
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5070
   ScaleWidth      =   6300
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton cmdButton 
      Cancel          =   -1  'True
      Caption         =   "删除(&D)"
      Height          =   345
      Index           =   2
      Left            =   5010
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   900
      Width           =   1215
   End
   Begin MSRDC.MSRDC MSRDC1 
      Height          =   330
      Left            =   5130
      Top             =   4650
      Visible         =   0   'False
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   582
      _Version        =   393216
      Options         =   0
      CursorDriver    =   0
      BOFAction       =   0
      EOFAction       =   0
      RecordsetType   =   1
      LockType        =   3
      QueryType       =   0
      Prompt          =   3
      Appearance      =   1
      QueryTimeout    =   30
      RowsetSize      =   100
      LoginTimeout    =   15
      KeysetSize      =   0
      MaxRows         =   0
      ErrorThreshold  =   -1
      BatchSize       =   15
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Enabled         =   -1  'True
      ReadOnly        =   0   'False
      Appearance      =   -1  'True
      DataSourceName  =   ""
      RecordSource    =   ""
      UserName        =   ""
      Password        =   ""
      Connect         =   ""
      LogMessages     =   ""
      Caption         =   "MSRDC1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.CommandButton cmdButton 
      Default         =   -1  'True
      Height          =   345
      Index           =   0
      Left            =   5010
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   120
      Width           =   1215
   End
   Begin VB.CommandButton cmdButton 
      Height          =   345
      Index           =   1
      Left            =   5010
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   510
      Width           =   1215
   End
   Begin MSFlexGridLib.MSFlexGrid grdCol 
      Bindings        =   "frmSelectStdVoucher.frx":0000
      Height          =   4935
      Left            =   60
      TabIndex        =   0
      Top             =   60
      Width           =   4875
      _ExtentX        =   8599
      _ExtentY        =   8705
      _Version        =   393216
      Rows            =   3
      FixedCols       =   0
      BackColorBkg    =   16777215
      GridColorFixed  =   16777215
      FocusRect       =   0
      GridLines       =   0
      SelectionMode   =   1
      AllowUserResizing=   1
      FormatString    =   "编号         |名称                                  "
   End
End
Attribute VB_Name = "frmSelectStdVoucher"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'   WXY
'   1999-08-19
'   Select StdVoucher Form
Private mGrid As New Grid
Private lngstdVoucherID As Long

'//////////////////////////////////////////////////////////////////////////////////
'                                                                                 /
'                               接         口                                     /
'                                                                                 /
'//////////////////////////////////////////////////////////////////////////////////
Public Function SelectVoucher() As Long
    
    Me.Show vbModal
    SelectVoucher = lngstdVoucherID
End Function

'//////////////////////////////////////////////////////////////////////////////////
Private Sub cmdButton_Click(index As Integer)
    Select Case index
    Case 0  '确定
        If grdCol.Rows <= 1 Then
            lngstdVoucherID = 0
        ElseIf grdCol.ColSel = 0 Then
            lngstdVoucherID = 0
        Else
            lngstdVoucherID = C2lng(grdCol.TextMatrix(grdCol.Row, 0))
        End If
        Unload Me
    Case 1  '取消
        lngstdVoucherID = 0
        Unload Me
    Case 2  '删除
        cmdDelete_Click
    End Select
End Sub

Private Sub Form_Activate()
    Call InitForm
End Sub

Private Sub Form_Load()
    Set Me.Icon = Utility.GetFormResPicture(139, vbResIcon)
    Me.top = (Screen.Height - Me.Height) / 2
    Me.Left = (Screen.width - Me.width) / 2
    
    cmdButton(0).Picture = Utility.GetFormResPicture(1001, 0)
    cmdButton(1).Picture = Utility.GetFormResPicture(1002, 0)
    
'    Call InitForm
    
    lngstdVoucherID = 0
    Set mGrid.Grid = grdCol
    
End Sub

Private Function InitForm() As Boolean
    Dim strSql As String
    Dim recTmp As rdoResultset
    
    On Error GoTo err_H
    
    Screen.MousePointer = vbHourglass
    
    strSql = "SELECT lngVoucherID AS ID,strVoucherNO  编号,strVoucherName as 名称 FROM StdVoucher ORDER BY strVoucherNO ASC"
    Set recTmp = gclsBase.BaseDB.OpenResultset(strSql, rdOpenStatic)
    
    Set MSRDC1.Resultset = recTmp
    
    grdCol.ColWidth(0) = 0
    grdCol.ColWidth(1) = grdCol.width / 3
    grdCol.ColWidth(2) = grdCol.width - grdCol.ColWidth(1)
    
    mGrid.SetupStyle
    If grdCol.Rows > 1 Then
        grdCol.ColSel = grdCol.Cols - 1
        cmdButton(2).Enabled = True
    Else
        grdCol.ColSel = 0
        cmdButton(2).Enabled = False
    End If
    InitForm = True
EndProc:
    Screen.MousePointer = vbDefault
    Exit Function
err_H:
    InitForm = False
    GoTo EndProc
End Function

Private Sub Form_Unload(Cancel As Integer)
    Set mGrid = Nothing
End Sub

'删除“样板凭证”
Private Sub cmdDelete_Click()
    If grdCol.Rows <= 1 Then
        lngstdVoucherID = 0
    ElseIf grdCol.ColSel = 0 Then
        lngstdVoucherID = 0
    Else
        lngstdVoucherID = C2lng(grdCol.TextMatrix(grdCol.Row, 0))
    End If
    
    Dim strSql As String
    
    If lngstdVoucherID = 0 Then Exit Sub
    If ShowMsg(Me.hwnd, "您确实要删除样板凭证“" & grdCol.TextMatrix(grdCol.Row, 1) & " " & grdCol.TextMatrix(grdCol.Row, 2) & "”吗?", MB_SYSTEMMODAL + MB_ICONQUESTION + MB_YESNO + MB_DEFBUTTON2, _
                        "提示信息") = vbNo Then Exit Sub
    
    strSql = "DELETE FROM stdVoucherDetail WHERE lngVoucherID = " & lngstdVoucherID
    If gclsBase.ExecSQL(strSql) = False Then
        ShowMsg Me.hwnd, "删除样板凭证“" & grdCol.TextMatrix(grdCol.Row, 1) & " " & grdCol.TextMatrix(grdCol.Row, 2) & "”错误!", MB_SYSTEMMODAL + MB_ICONEXCLAMATION, "错误提示"
        Exit Sub
    End If
    strSql = "DELETE FROM stdVoucher WHERE lngVoucherID = " & lngstdVoucherID
    If gclsBase.ExecSQL(strSql) = False Then
        ShowMsg Me.hwnd, "删除样板凭证“" & grdCol.TextMatrix(grdCol.Row, 1) & " " & grdCol.TextMatrix(grdCol.Row, 2) & "”错误!", MB_SYSTEMMODAL + MB_ICONEXCLAMATION, "错误提示"
        Exit Sub
    End If
    
    If grdCol.Rows = 2 Then
        grdCol.Rows = 1
        grdCol.ColSel = 0
    Else
        grdCol.RemoveItem grdCol.Row
    End If
    grdCol.Refresh
    
    lngstdVoucherID = 0
End Sub

Private Sub grdCol_DblClick()
    If grdCol.Rows = 1 Or grdCol.Row = 0 Or grdCol.ColSel = 0 Then Exit Sub
    cmdButton_Click 0   'OK
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -