📄
字号:
VERSION 5.00
Object = "{D76D7128-4A96-11D3-BD95-D296DC2DD072}#1.0#0"; "VSOCX7.OCX"
Begin VB.Form CL_EndCheckOut
BorderStyle = 1 'Fixed Single
Caption = "期末结帐"
ClientHeight = 4800
ClientLeft = 45
ClientTop = 330
ClientWidth = 5325
HelpContextID = 130408
Icon = "处理_期末结帐.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4800
ScaleWidth = 5325
StartUpPosition = 2 '屏幕中心
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 1
Left = 2670
Top = 0
End
Begin VB.OptionButton Opt_Hfqmjz
Caption = "恢复期末结帐"
Height = 255
Left = 1320
TabIndex = 7
Top = 4410
Width = 1425
End
Begin VB.OptionButton Opt_Qmjz
Caption = "期末结帐"
Height = 255
Left = 150
TabIndex = 6
Top = 4410
Value = -1 'True
Width = 1095
End
Begin VB.CommandButton Com_Qx
Cancel = -1 'True
Caption = "取消(&C)"
Height = 300
Left = 4080
TabIndex = 1
Top = 4380
Width = 1120
End
Begin VB.CommandButton Com_Qmjz
Caption = "确认(&O)"
Height = 300
Left = 2850
TabIndex = 0
Top = 4380
Width = 1120
End
Begin VSFlex8Ctl.VSFlexGrid CxbbGrid
Height = 3795
Left = 120
TabIndex = 3
Top = 450
Width = 5085
_ExtentX = 8969
_ExtentY = 6694
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 = 0
BackColor = -2147483643
ForeColor = 0
BackColorFixed = -2147483633
ForeColorFixed = -2147483630
BackColorSel = 16777152
ForeColorSel = -2147483640
BackColorBkg = -2147483636
BackColorAlternate= -2147483643
GridColor = -2147483633
GridColorFixed = -2147483632
TreeColor = 33023
FloodColor = 192
SheetBorder = -2147483642
FocusRect = 1
HighLight = 1
AllowSelection = 0 'False
AllowBigSelection= 0 'False
AllowUserResizing= 0
SelectionMode = 1
GridLines = 1
GridLinesFixed = 2
GridLineWidth = 1
Rows = 50
Cols = 10
FixedRows = 1
FixedCols = 1
RowHeightMin = 0
RowHeightMax = 0
ColWidthMin = 0
ColWidthMax = 0
ExtendLastCol = 0 'False
FormatString = ""
ScrollTrack = 0 'False
ScrollBars = 0
ScrollTips = 0 'False
MergeCells = 0
MergeCompare = 0
AutoResize = -1 'True
AutoSizeMode = 0
AutoSearch = 0
MultiTotals = -1 'True
SubtotalPosition= 0
OutlineBar = 0
OutlineCol = 0
Ellipsis = 0
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
End
Begin VB.Label Lbl_labTitle
AutoSize = -1 'True
Caption = "当前会计期间:"
Height = 240
Left = 180
TabIndex = 5
Top = 120
Width = 1170
End
Begin VB.Label Lbl_labText
AutoSize = -1 'True
Caption = "Label1"
Height = 240
Left = 1440
TabIndex = 4
Top = 120
Width = 1170
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "数据正在处理中..."
ForeColor = &H000000FF&
Height = 210
Left = 3270
TabIndex = 2
Top = 120
Visible = 0 'False
Width = 1530
End
End
Attribute VB_Name = "CL_EndCheckOut"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'**************************************************************************
'* 模 块 名 称 :期末结帐
'* 功 能 描 述 :
'* 程序员姓名 :杨波
'* 最后修改人 :白凤英
'* 最后修改时间:2001/12/10
'* 备 注:程序中所有依实际情况自定义部分均用[>> <<]括起
'**************************************************************************
Dim mKjYear As Integer '调用年度
Dim mKjMonth As Integer '调用月份
Dim FindMonth As Integer '查询月份
Dim DyLock As Boolean
Dim Dqrow As Integer
'以下为固定使用变量
Dim ReportTitle As String '报表主标题
Dim Dyymctbl As New DY_Dyymsz '打印页面窗体变量
Dim GridCode As String '显示网格网格代码
Dim GridInf() As Variant '整个网格设置信息
Dim Tsxx As String '系统提示信息
Dim Qslz As Long '网格隐藏(非操作显示)列数
Dim Sjhgd As Double '网格数据行高度
Dim Sfxshjwg As Boolean '是否显示合计网格
Dim GridBoolean() As Boolean '网格列信息(布尔型)
Dim GridStr() As String '网格列信息(字符型)
Dim GridInt() As Integer '网格列信息(整型)
Dim Szzls As Integer '数组总列数(网格列数-1)
Dim Jsqte%
Private Sub Sub_Qmjz() '期末结帐
Dim Rectemp As New ADODB.Recordset
Dim RecTempFz As New ADODB.Recordset
Dim Rec_Query As Recordset
Dim Msg As Integer
Dim Now_year As Integer
Dim Now_period As Integer
Dim mPeriod As Integer
Dim mYear As Integer
Dim Zfstr As String
Dim SqlStr As String
Now_year = PGKjYear
Now_period = PGNowmon
If Now_period = Val(CxbbGrid.TextMatrix(CxbbGrid.Rows - 1, Sydz("001", GridStr(), Szzls))) Then
mPeriod = 1
mYear = PGKjYear + 1
Else
mPeriod = Now_period + 1
mYear = PGKjYear
End If
'系统集成时,库房未记帐时核算不能记帐
If Xt_XtJc Then
Set Rectemp = Cw_DataEnvi.DataConnect.Execute("select * from gy_kjrlb where kjyear=" & Now_year & " and period=" & Now_period)
If Not Rectemp.EOF Then
If Not Rectemp.Fields("kfjzbz") Then
Tsxx = "库存管理系统未结帐,不允许核算系统结帐!"
Call Xtxxts(Tsxx, 0, 4)
Exit Sub
End If
End If
End If
'操作日期大于等于单据录入的最大日期
SqlStr = "select max(chalkdate) as maxdate from chhs_list a where kjyear=" & Now_year & " and period=" & Now_period
Set Rectemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
If Not Rectemp.EOF Then
If Xtrq < Rectemp.Fields("maxdate") Then
Tsxx = "操作日期必须>=单据记帐日期 " + Format(CStr(Rectemp.Fields("maxdate")), "yyyy-mm-dd")
Call Xtxxts(Tsxx, 0, 4)
Exit Sub
End If
End If
'判断是否全部期末处理完毕
SqlStr = "SELECT WhName,EndDealFlagChhs from GY_WareHouse Where ChhsUseFlag=1 ORDER BY WhCode "
Set Rectemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
Zfstr = ""
Do While Not Rectemp.EOF
If Not Rectemp.Fields("EndDealFlagChhs") Then
If Zfstr = "" Then
Zfstr = Trim(Rectemp.Fields("WhName"))
Else
Zfstr = Zfstr + "、" + Trim(Rectemp.Fields("WhName"))
End If
End If
Rectemp.MoveNext
Loop
If Zfstr <> "" Then
Tsxx = "仓库 (" + Zfstr + ") 未进行期末处理!"
Call Xtxxts(Tsxx, 0, 1)
Exit Sub
End If
'判断上月是否结帐
If Now_period = 1 Then
SqlStr = "SELECT * FROM GY_Kjrlb WHERE Kjyear=" & Now_year - 1 & " order by period desc "
Set Rectemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
If Not Rectemp.EOF Then
If Not Rectemp.Fields("Chhsjzbz") Then
Tsxx = "上月未结帐!"
Call Xtxxts(Tsxx, 0, 1)
Exit Sub
End If
End If
Else
SqlStr = "SELECT * FROM GY_Kjrlb WHERE Kjyear=" & Now_year & " and period=" & Now_period - 1
Set Rectemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
If Not Rectemp.EOF Then
If Not Rectemp.Fields("Chhsjzbz") Then
Tsxx = "上月未结帐!"
Call Xtxxts(Tsxx, 0, 1)
Exit Sub
End If
End If
End If
Tsxx = "是否进行期末结帐?"
Msg = Xtxxts(Tsxx, 1, 2)
If Not Msg = 6 Then Exit Sub
Label1.Visible = True
Label1.Refresh
SqlStr = "SELECT Chhsjzbz from GY_Kjrlb WHERE Kjyear='" & Now_year & "' and Period='" & Now_period & "'"
Set Rectemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
If Rectemp.Fields("Chhsjzbz") Then
Tsxx = "期末已经结帐,不能再次结帐!"
Label1.Visible = False
Call Xtxxts(Tsxx, 0, 4)
Exit Sub
End If
Cw_DataEnvi.DataConnect.BeginTrans
'调整期末结存,生成下月期初
If RecTempFz.State = 1 Then RecTempFz.Close
RecTempFz.Open "SELECT * FROM Chhs_Mate where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockBatchOptimistic
If Rectemp.State = 1 Then Rectemp.Close
Rectemp.Open "SELECT * FROM Chhs_Mate WHERE Kjyear=" & Now_year & " and Period=" & Now_period, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockBatchOptimistic
Do While Not Rectemp.EOF
'期末结存
Rectemp.Fields("EndQuan") = Val(Rectemp.Fields("StartQuan")) + Val(Rectemp.Fields("InQuan")) - Val(Rectemp("OutQuan"))
Rectemp.Fields("EndMoney") = Val(Rectemp.Fields("StartMoney")) + Val(Rectemp.Fields("InMoney")) - Val(Rectemp("OutMoney"))
If Not Rectemp.Fields("EndQuan") = 0 Then
Rectemp.Fields("EndPrice") = Format(Val(Rectemp.Fields("EndMoney")) / Val(Rectemp.Fields("EndQuan")), "###." + String(Xtdjxsws, "0"))
Else
Rectemp.Fields("EndPrice") = 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -