form_newkjqj.frm

来自「新世纪ERP系统管理源代码」· FRM 代码 · 共 324 行

FRM
324
字号
VERSION 5.00
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Object = "{8099FCC2-0A81-11D2-BAA4-04F205C10000}#1.0#0"; "Vsflex6.ocx"
Begin VB.Form Form_NewKJQJ 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "创建下年度会计期间"
   ClientHeight    =   4290
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5430
   Icon            =   "Form_NewKJQJ.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4290
   ScaleWidth      =   5430
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command1 
      Caption         =   "确定&D"
      Height          =   315
      Index           =   0
      Left            =   2850
      TabIndex        =   1
      Top             =   3900
      Width           =   1125
   End
   Begin VB.CommandButton Command1 
      Caption         =   "取消&C"
      Height          =   315
      Index           =   1
      Left            =   4230
      TabIndex        =   0
      Top             =   3900
      Width           =   1125
   End
   Begin TabDlg.SSTab SSTab1 
      Height          =   3795
      Left            =   30
      TabIndex        =   2
      Top             =   30
      Width           =   5325
      _ExtentX        =   9393
      _ExtentY        =   6694
      _Version        =   393216
      Style           =   1
      Tabs            =   1
      TabHeight       =   520
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      TabCaption(0)   =   "会计期间"
      TabPicture(0)   =   "Form_NewKJQJ.frx":08CA
      Tab(0).ControlEnabled=   -1  'True
      Tab(0).Control(0)=   "Label2"
      Tab(0).Control(0).Enabled=   0   'False
      Tab(0).Control(1)=   "FlexGrid"
      Tab(0).Control(1).Enabled=   0   'False
      Tab(0).Control(2)=   "Text2"
      Tab(0).Control(2).Enabled=   0   'False
      Tab(0).ControlCount=   3
      Begin VB.TextBox Text2 
         Enabled         =   0   'False
         Height          =   315
         Left            =   2850
         Locked          =   -1  'True
         TabIndex        =   3
         Text            =   "2000"
         Top             =   1470
         Width           =   1185
      End
      Begin VSFlex6Ctl.vsFlexGrid FlexGrid 
         Height          =   3135
         Left            =   210
         TabIndex        =   4
         Top             =   450
         Width           =   2145
         _cx             =   8326856
         _cy             =   8328602
         _ConvInfo       =   1
         Appearance      =   1
         BorderStyle     =   1
         Enabled         =   -1  'True
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         MousePointer    =   1
         BackColor       =   -2147483643
         ForeColor       =   -2147483640
         BackColorFixed  =   -2147483633
         ForeColorFixed  =   -2147483630
         BackColorSel    =   -2147483635
         ForeColorSel    =   -2147483634
         BackColorBkg    =   -2147483636
         BackColorAlternate=   -2147483643
         GridColor       =   -2147483633
         GridColorFixed  =   -2147483632
         TreeColor       =   -2147483632
         FloodColor      =   192
         SheetBorder     =   -2147483642
         FocusRect       =   1
         HighLight       =   1
         AllowSelection  =   -1  'True
         AllowBigSelection=   -1  'True
         AllowUserResizing=   1
         SelectionMode   =   1
         GridLines       =   1
         GridLinesFixed  =   2
         GridLineWidth   =   1
         Rows            =   13
         Cols            =   2
         FixedRows       =   1
         FixedCols       =   0
         RowHeightMin    =   275
         RowHeightMax    =   0
         ColWidthMin     =   0
         ColWidthMax     =   0
         ExtendLastCol   =   0   'False
         FormatString    =   "<期间|开始日期      "
         ScrollTrack     =   0   'False
         ScrollBars      =   3
         ScrollTips      =   0   'False
         MergeCells      =   0
         MergeCompare    =   0
         AutoResize      =   -1  'True
         AutoSizeMode    =   0
         AutoSearch      =   0
         MultiTotals     =   -1  'True
         SubtotalPosition=   1
         OutlineBar      =   0
         OutlineCol      =   0
         Ellipsis        =   1
         ExplorerBar     =   0
         PicturesOver    =   0   'False
         FillStyle       =   0
         RightToLeft     =   0   'False
         PictureType     =   0
         TabBehavior     =   0
         OwnerDraw       =   0
         Editable        =   0   'False
         ShowComboButton =   -1  'True
         WordWrap        =   0   'False
         TextStyle       =   0
         TextStyleFixed  =   0
         OleDragMode     =   0
         OleDropMode     =   0
         DataMode        =   0
         VirtualData     =   -1  'True
         DataMember      =   ""
         Begin VB.TextBox Data_T 
            BorderStyle     =   0  'None
            Height          =   225
            Left            =   450
            TabIndex        =   5
            Top             =   270
            Visible         =   0   'False
            Width           =   1335
         End
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "下会计年度:"
         Height          =   180
         Left            =   2850
         TabIndex        =   6
         Top             =   1230
         Width           =   990
      End
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Index           =   0
      Left            =   3690
      TabIndex        =   7
      Text            =   "Text1"
      Top             =   2970
      Visible         =   0   'False
      Width           =   615
   End
End
Attribute VB_Name = "Form_NewKJQJ"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Row_int As Integer, Col_int As Integer


Private Sub Command1_Click(Index As Integer)
    Dim Ssql As String
    Dim i As Integer
    Dim aDo_Date As New Recordset
    On Error GoTo error_exit
    
    If Index = 1 Then Unload Me: Exit Sub
    
    YesNoStr = MsgBox("你是否真的要创建下年度会计期间!  ", vbYesNo + 32)
    If YesNoStr = vbNo Then Exit Sub
    
    aDo_Date.Open "select * from " & Trim(Text1(0).Tag) & ".dbo.Gy_kjrlb", Conn_System, adOpenStatic, adLockBatchOptimistic
    With aDo_Date
    For i = 1 To 12
        .AddNew
        !KjYear = Trim(Text2.Text)
        !Period = FlexGrid.TextMatrix(i, 0)
        !qsrq = FlexGrid.TextMatrix(i, 1)
        If i < 12 Then
            !zzrq = DateAdd("d", -1, FlexGrid.TextMatrix(i + 1, 1))
         Else
            !zzrq = DateAdd("d", -1, DateAdd("m", 1, FlexGrid.TextMatrix(i, 1)))
        End If
        .Update
    Next
    .UpdateBatch adAffectAllChapters
    .Close
    Set aDo_Date = Nothing
    End With
    
    Unload Me
    Exit Sub
    
error_exit:
    MsgBox Err.Description, 16

End Sub



Private Sub Data_T_GotFocus()
    With FlexGrid
        If .Col = 1 Then
            Data_T.Text = .TextMatrix(.Row, 1)
            Data_T.SelLength = Len(Data_T.Text)
            Row_int = .Row
            Col_int = .Col
        End If
    End With
End Sub

Private Sub Data_T_LostFocus()
    Dim i As Integer
    Dim r As Integer
    Dim data_er As Date
    Dim New_date As String
    On Error Resume Next
    r = 1
    With FlexGrid
        If IsDate(Data_T.Text) = True Then
            New_date = .TextMatrix(Row_int, Col_int)
            .TextMatrix(Row_int, Col_int) = Format(Data_T.Text, "yyyy-mm-dd")
            If New_date <> Trim(Data_T.Text) Then
                For i = Row_int + 1 To 12
                     data_er = CDate(Val(Mid(.TextMatrix(Row_int, Col_int), 1, 4)) & "-" _
                                      & Val(Mid(.TextMatrix(Row_int, 1), 6, 5)))
                    .TextMatrix(i, 1) = DateAdd("m", r, data_er)
                    r = r + 1
                Next
            End If
            
        Else
            Data_T.Text = .TextMatrix(Row_int, Col_int)
        End If
         
    End With

End Sub

Private Sub FlexGrid_Scroll()
    Data_T.Visible = False
End Sub

Private Sub FlexGrid_SelChange()
    With FlexGrid
         .Col = 1
         Data_T.Move .CellLeft, .CellTop, .CellWidth, .CellHeight - 10
         Data_T.Visible = True
         Data_T.SetFocus
    End With
End Sub

Private Sub Form_Activate()
On Error GoTo error_exit
    Dim TF As Boolean
    Dim aDo_data As New Recordset
    Dim aDo_data1 As New Recordset
    
    TF = False

    
    Set aDo_data1 = Conn_System.Execute("select * from " & Text1(0).Tag & ".dbo.Gy_kjrlb order by qsrq DESC")
    
    If aDo_data1.RecordCount <= 0 Then

    Else
        Dim i As Integer
        For i = 1 To 12
            Text2.Text = aDo_data1!KjYear + 1
            FlexGrid.TextMatrix(13 - i, 0) = 13 - i
            FlexGrid.TextMatrix(13 - i, 1) = DateAdd("YYYY", 1, aDo_data1!qsrq)
            aDo_data1.MoveNext
        Next i
    End If
    aDo_data1.Close
    

    Exit Sub
error_exit:
    MsgBox Err.Description, 16
    Unload Me
End Sub


⌨️ 快捷键说明

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