📄 frmfi_lockaccount.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmFI_LockAccount
BorderStyle = 3 'Fixed Dialog
Caption = "结账"
ClientHeight = 4380
ClientLeft = 45
ClientTop = 330
ClientWidth = 3495
Icon = "frmFI_LockAccount.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4380
ScaleWidth = 3495
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.PictureBox picBeginMonth
Appearance = 0 'Flat
BackColor = &H0000FFFF&
ForeColor = &H80000008&
Height = 210
Left = 2250
ScaleHeight = 180
ScaleWidth = 180
TabIndex = 7
Top = 1845
Width = 210
End
Begin VB.CommandButton Command1
Caption = "反结账(&R)"
Default = -1 'True
Height = 375
Left = 2280
TabIndex = 6
Top = 2880
Width = 1065
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "退出(&X)"
Height = 345
Left = 2280
TabIndex = 4
Top = 3570
Width = 1065
End
Begin VB.CommandButton cmdOk
Caption = "结账(&O)"
Height = 345
Left = 2280
TabIndex = 3
Top = 2400
Width = 1065
End
Begin VB.PictureBox PicLockAccountDate
Height = 285
Left = 2280
ScaleHeight = 225
ScaleWidth = 945
TabIndex = 1
Top = 780
Width = 1005
Begin VB.Label lblLockAccountDate
AutoSize = -1 'True
Caption = "2000-07-16"
Height = 180
Left = 0
TabIndex = 5
Top = 30
Width = 900
End
End
Begin MSFlexGridLib.MSFlexGrid mfgLockAccountDate
Height = 4035
Left = 90
TabIndex = 0
Top = 180
Width = 1995
_ExtentX = 3519
_ExtentY = 7117
_Version = 393216
FixedCols = 0
BackColorBkg = 16777215
AllowBigSelection= 0 'False
ScrollBars = 0
Appearance = 0
FormatString = "月份|<是否结账"
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "启用月份"
Height = 180
Left = 2520
TabIndex = 8
Top = 1845
Width = 720
End
Begin VB.Label lblTitle
Caption = "结账日期:"
Height = 255
Left = 2280
TabIndex = 2
Top = 450
Width = 945
End
End
Attribute VB_Name = "frmFI_LockAccount"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Base 1
Dim rstTemp As ADODB.Recordset
Dim rstPeriod As ADODB.Recordset
Dim adoCmd As ADODB.Command
Dim sSQL As String
Dim i As Integer
Dim SubSysBeginYear As String '账务子系统启用年份
Dim SubSysBeginMonth As Integer '账务子系统启用月份
Dim SubSysModiYear As String '账务子系统已结账年份
Dim SubSysModiMonth As Integer '账务子系统已结账月份
Dim ModiMonthOfOperateYear As Integer '当前注册年份已结账月份
Dim NotModiMonth As Integer '当前注册年份未结账月份
Public Function ubOK() As Boolean
'取得账务子系统启用年份、月份
Set rstTemp = New ADODB.Recordset
rstTemp.CursorLocation = adUseClient
sSQL = "SELECT * FROM tSYS_SubSysUsed WHERE AccountID = '" & glo.sAccountID & _
"' AND SubSysID = '" & gloSys.sSubSysID & "'"
rstTemp.Open sSQL, gloSys.cnnSYS, adOpenStatic, adLockReadOnly
With rstTemp
'如果当前注册年份大于子系统结账年份,
'则如果子系统结账月份小于12月份,
'则报错;
If glo.sOperateYear > .Fields("ModiYear").Value Then
If .Fields("ModiMonth").Value < 12 Or glo.sOperateYear <> .Fields("ModiYear").Value + 1 Then
MsgBox .Fields("ModiYear").Value & "年账务没有结账至12月份, 本年度不能结账!", _
vbOKOnly + vbInformation
ubOK = False
Else
ubOK = True
End If
Else
ubOK = True
End If
.Close
End With
End Function
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOk_Click()
Me.MousePointer = vbHourglass
If IsCheck Then
'修改系统表中的子系统启用表
Set adoCmd = New ADODB.Command
adoCmd.ActiveConnection = gloSys.cnnSYS
adoCmd.CommandText = "UPDATE tSYS_SubSysUsed SET ModiYear = '" & glo.sOperateYear & _
"',ModiMonth = " & NotModiMonth & _
" WHERE AccountId = '" & glo.sAccountID & _
"' AND SubSysId = '" & gloSys.sSubSysID & "'"
adoCmd.Execute
'修改系统内可以进行新业务的最早日期
If NotModiMonth = 12 Then
glo.sUnEarlierDate = CStr(CInt(glo.sOperateYear) + 1) & "-01-01"
Else
'在会计期间表中查找该已结账年、期
Set rstPeriod = New ADODB.Recordset
rstPeriod.CursorLocation = adUseClient
rstPeriod.Open "SELECT * FROM tSYS_Period WHERE AccountID='" & glo.sAccountID & _
"' AND year='" & glo.sOperateYear & _
"' AND PeriodID=" & NotModiMonth, _
gloSys.cnnSYS, adOpenStatic, adLockReadOnly
glo.sUnEarlierDate = Format(DateAdd("d", 1, _
rstPeriod.Fields("toDate").Value), "yyyy-mm-dd")
End If
MsgBox glo.sOperateYear & "年" & NotModiMonth & "月结账完毕!", vbOKOnly + vbInformation
Call FillGrid
End If
Me.MousePointer = vbDefault
End Sub
'结账前条件检查
Private Function IsCheck() As Boolean
IsCheck = True
'判断当前需要结账的月份的凭证是否已经全部记账
Set rstTemp = New ADODB.Recordset
rstTemp.CursorLocation = adUseClient
sSQL = "SELECT xgbz,COUNT(*) iCount FROM tZW_Pzsj" & glo.sOperateYear & _
" WHERE kjqj = " & NotModiMonth & " AND xgbz <> '2' " & _
" GROUP BY xgbz"
rstTemp.Open sSQL, glo.cnnMain, adOpenStatic, adLockReadOnly
With rstTemp
Do Until .EOF
.MoveFirst
If .Fields("iCount").Value <> 0 Then
IsCheck = False
If .Fields("xgbz").Value = 0 Then
MsgBox glo.sOperateYear & "年" & NotModiMonth & _
"月存在未复核的凭证!", vbOKOnly + vbInformation
Exit Function
ElseIf .Fields("xgbz").Value = 1 Then
MsgBox glo.sOperateYear & "年" & NotModiMonth & _
"月存在未记账的凭证!", vbOKOnly + vbInformation
Exit Function
Else
MsgBox glo.sOperateYear & "年" & NotModiMonth & _
"月存在有错的凭证!", vbOKOnly + vbInformation
Exit Function
End If
End If
.MoveNext
Loop
End With
'判断当前需要结账的月份是否存在已记账凭证;
'如果当前需要结账的月份没有记账凭证, 则提示是否结账;
Set rstTemp = New ADODB.Recordset
rstTemp.CursorLocation = adUseClient
sSQL = "SELECT COUNT(*) iCount FROM tZW_Pzsj" & glo.sOperateYear & _
" WHERE kjqj = " & NotModiMonth & " AND xgbz = '2'"
rstTemp.Open sSQL, glo.cnnMain, adOpenStatic, adLockReadOnly
If rstTemp.Fields("iCount").Value = 0 Then
If MsgBox(glo.sOperateYear & "年" & NotModiMonth & _
"月没有发生记账凭证, 是否结账?", vbQuestion + vbYesNo + vbDefaultButton2) = vbYes Then
IsCheck = True
Else
IsCheck = False
Exit Function
End If
End If
'判断当前会计期间是否有断号凭证
If Not IsPzbhCheck(CStr(NotModiMonth)) Then
MsgBox glo.sOperateYear & "年" & NotModiMonth & _
"月有断号凭证,详见凭证缺号表!", vbInformation, "提示:"
IsCheck = False
Else
IsCheck = True
End If
End Function
Private Sub Command1_Click()
'当注册年份等于已结账年份时,才可以执行反结账
If glo.sOperateYear = SubSysModiYear Then
If glo.sOperateYear = SubSysBeginYear And _
ModiMonthOfOperateYear < Val(Format(SubSysBeginMonth, "##")) Then
MsgBox "反结账月份不能小于账务子系统启用月份!", vbOKOnly + vbInformation
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -