资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:13k
源码类别:
企业管理
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{D76D7128-4A96-11D3-BD95-D296DC2DD072}#1.0#0"; "VSOCX7.OCX"
- Begin VB.Form Cask_CheckOut
- BorderStyle = 3 'Fixed Dialog
- Caption = "月末结帐"
- ClientHeight = 4245
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 5280
- HelpContextID = 1715001
- Icon = "包装物管理系统_结帐处理_月末结帐.frx":0000
- KeyPreview = -1 'True
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4245
- ScaleWidth = 5280
- ShowInTaskbar = 0 'False
- StartUpPosition = 1 '所有者中心
- Begin VB.CommandButton CmdCheck
- Caption = "月末结帐"
- Height = 300
- Left = 2775
- TabIndex = 1
- Top = 3870
- Width = 1120
- End
- Begin VB.CommandButton CmdExit
- Caption = "退出"
- Height = 300
- Left = 4095
- TabIndex = 0
- Top = 3870
- Width = 1120
- End
- Begin VSFlex8Ctl.VSFlexGrid CzxsGrid
- Height = 3735
- Left = 90
- TabIndex = 2
- Top = 60
- Width = 5100
- _ExtentX = 8996
- _ExtentY = 6588
- 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 = 16777215
- ForeColor = -2147483640
- BackColorFixed = -2147483633
- ForeColorFixed = 0
- BackColorSel = 16777215
- ForeColorSel = -2147483634
- BackColorBkg = 12632256
- BackColorAlternate= 16777215
- GridColor = -2147483633
- GridColorFixed = 16777215
- TreeColor = -2147483632
- FloodColor = 0
- SheetBorder = -2147483642
- FocusRect = 1
- HighLight = 1
- AllowSelection = 0 'False
- AllowBigSelection= 0 'False
- AllowUserResizing= 0
- SelectionMode = 0
- GridLines = 3
- GridLinesFixed = 2
- GridLineWidth = 1
- Rows = 50
- Cols = 10
- FixedRows = 1
- FixedCols = 0
- RowHeightMin = 0
- 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 = 0
- ExplorerBar = 0
- PicturesOver = 0 'False
- FillStyle = 1
- 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
- End
- Attribute VB_Name = "Cask_CheckOut"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '******************************************************************
- '* 模 块 名 称 :月末结帐
- '* 功 能 描 述 :
- '* 程序员姓名 :邹力
- '* 最后修改人 :
- '* 最后修改时间:2001/12/10
- '* 备 注:程序中所有依实际情况自定义部分均用[>> <<]括起
- '******************************************************************
- '以下为固定使用变量(网格)
- Dim Cxnrrec As New ADODB.Recordset '显示查询内容动态集
- 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 GridBoolean() As Boolean '网格列信息(布尔型)
- Dim GridStr() As String '网格列信息(字符型)
- Dim GridInt() As Integer '网格列信息(整型)
- Dim Szzls As Integer '数组总列数(网格列数-1)
- Dim Rec_KJ As New ADODB.Recordset
- Dim jl_row As Integer
- Dim JL_Rec_KJ As Integer
- Dim QSRQ As String, ZZRQ As String
- Dim retrun_str As String
- Sub CancelCheck()
- If CzxsGrid.TextMatrix(CzxsGrid.Row, 4) = False Then
- Tsxx = "该会计期间还未结帐! "
- Call Xtxxts(Tsxx, 0, 4)
- Exit Sub
- End If
- On Error GoTo Swcwcl
- Rec_KJ.MoveFirst
- For Jsq = 1 To Rec_KJ.RecordCount
- If Rec_KJ.Fields("KJYear") = CzxsGrid.TextMatrix(CzxsGrid.Row, 0) Then
- If Rec_KJ.Fields("period") = CzxsGrid.TextMatrix(CzxsGrid.Row, 1) Then
- Rec_KJ.Fields("checkmark") = 0
- End If
- End If
- Rec_KJ.MoveNext
- Next Jsq
- Cw_DataEnvi.DataConnect.Execute ("Delete KF_CaskList Where year=" & CzxsGrid.TextMatrix(CzxsGrid.Row, 0) & " and period=" & CzxsGrid.TextMatrix(CzxsGrid.Row, 1))
- Cw_DataEnvi.DataConnect.Execute ("update KF_CaskChange set checkflag=0 where year=" & CzxsGrid.TextMatrix(CzxsGrid.Row, 0) & " and period=" & CzxsGrid.TextMatrix(CzxsGrid.Row, 1))
- Tsxx = "您已成功取消结帐! "
- Call Xtxxts(Tsxx, 0, 4)
- Exit Sub
- Swcwcl:
- Tsxx = "取消结帐失败!请您重试!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Sub
- End Sub
- Private Sub CmdCancel_Click()
- Call CancelCheck
- Call th_focus
- If jl_row = 1 Then
- Else
- jl_row = jl_row - 1
- End If
- End Sub
- Private Sub CmdCheck_Click()
- Call tc_zz '写入库存总帐
- End Sub
- Private Sub CmdExit_Click()
- Unload Me
- End Sub
- Private Sub Form_Load()
- '调入网格设置信息
- GridCode = "Cask_CheckOut"
- Call BzWgcsh(CzxsGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
- Qslz = GridInf(1)
- Sjhgd = GridInf(2)
- Szzls = CzxsGrid.Cols - 1
- '填 充 网 格
- Call Cxnrtcwg
- Set CxnrrecTemp = Cw_DataEnvi.DataConnect.Execute("select kjyear,period,CaskJzbz from gy_kjrlb where beginflag=1")
- With CzxsGrid
- .Cell(flexcpBackColor, CxnrrecTemp!Period, 0, CxnrrecTemp!Period, .Cols - 1) = &HFFFFC0
- End With
- End Sub
- Private Sub Cxnrtcwg() '查询内容填充网格
- Dim Sqlstr As String '查询连接串
- Dim Jsqte As Long '查询临时使用变量
- '为加快显示速度,将网格刷新动作冻结
- CzxsGrid.Redraw = False
- '[>>查询连接串
- Sqlstr = "SELECT * FROM Gy_Kjrlb Order By KjYear,Period"
- '<<]
- Set Cxnrrec = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- With Cxnrrec
- CzxsGrid.Rows = CzxsGrid.FixedRows
- If .EOF And .BOF Then
- CzxsGrid.Redraw = True
- Exit Sub
- End If
- Jsqte = CzxsGrid.FixedRows
- Do While Not .EOF
- CzxsGrid.AddItem ""
- Call Jltcwg(Cxnrrec, Jsqte) '调入填充网格子过程
- CzxsGrid.RowHeight(Jsqte) = Sjhgd '设置网格高度
- .MoveNext
- Jsqte = Jsqte + 1
- Loop
- End With
- '将网格刷新动作解冻
- CzxsGrid.Redraw = True
- End Sub
- Private Sub Jltcwg(Jlbrec As ADODB.Recordset, Rowjsq As Long) '记录内容填充网格
- '[>>以下为自定义部分
- With Jlbrec
- CzxsGrid.TextMatrix(Rowjsq, Sydz("001", GridStr(), Szzls)) = !KjYear '会计年度
- CzxsGrid.TextMatrix(Rowjsq, Sydz("002", GridStr(), Szzls)) = !Period '会计期间
- CzxsGrid.TextMatrix(Rowjsq, Sydz("003", GridStr(), Szzls)) = !QSRQ '起始日期
- CzxsGrid.TextMatrix(Rowjsq, Sydz("004", GridStr(), Szzls)) = !ZZRQ '终止日期
- CzxsGrid.TextMatrix(Rowjsq, Sydz("005", GridStr(), Szzls)) = !CaskJzbz '结帐
- End With
- '以上为自定义部分<<]
- End Sub
- Private Sub tc_zz()
- Dim Sqlstr As String
- Dim Rec_Cask As New Recordset
- Dim StrCheck As String
- Dim RecList As New Recordset
- Dim RecLast As New Recordset
- Dim RecTemp As New Recordset
- Dim CxnrrecTemp As ADODB.Recordset
- On Error GoTo Swcwcl
- '该年度是否结帐完成
- Sqlstr = "SELECT * FROM Gy_Kjrlb where CaskJzbz=0 Order By KjYear,Period"
- Set Cxnrrec = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If Cxnrrec.EOF Then
- Tsxx = "该会计年度月份已经结帐完毕!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Sub
- End If
- Set CxnrrecTemp = Cw_DataEnvi.DataConnect.Execute("select * from gy_kjrlb where beginflag=1")
- If Not CxnrrecTemp!CaskJzbz Then
- If Not (CxnrrecTemp!ZZRQ >= Xtrq And Xtrq >= CxnrrecTemp!QSRQ) Then
- Tsxx = "登录日期不在结帐会计期间内,不能进行月末结帐,请重新登录!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Sub
- End If
- Else
- If Not (Cxnrrec!ZZRQ >= Xtrq And Xtrq >= Cxnrrec!QSRQ) Then
- Tsxx = "登录日期不在结帐会计期间内,不能进行月末结帐,请重新登录!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Sub
- End If
- End If
- '期初数据结帐
- Sqlstr = "select * from gy_accinformation where ItemCode='Cask_StartChalk'"
- Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If Val(Trim(Rec_Query!ItemValue)) = 0 Then
- Tsxx = "期初数据未结帐,不能进行月末结帐!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Sub
- End If
- If Not CxnrrecTemp!CaskJzbz Then
- Cw_DataEnvi.DataConnect.Execute ("UPdate gy_kjrlb set CaskJzbz=1 where kjyear=" & CxnrrecTemp!KjYear & " and period<" & CxnrrecTemp!Period)
- End If
- Sqlstr = "SELECT * FROM Gy_Kjrlb where CaskJzbz=0 Order By KjYear,Period"
- Set Cxnrrec = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- '业务处理中,单据是否审核
- Sqlstr = "SELECT * FROM Cask_V_StartInputList where BillType<>1 and Checker='' and HIDate Between '" & CDate(Trim(Cxnrrec!QSRQ)) & "' and '" & CDate(Trim(Cxnrrec!ZZRQ)) & "'"
- Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If Not Rec_Query.EOF Then
- Tsxx = "该会计期间的业务处理中,有未审核的单据,不能进行月末结帐!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Sub
- End If
- Cw_DataEnvi.DataConnect.Execute ("Cask_SP_Check " & Val(Trim(Cxnrrec!Period)) & "," & Val(Trim(Cxnrrec!KjYear)))
- Sqlstr = "SELECT * FROM Gy_Kjrlb where KjYear=" & Cxnrrec!KjYear & " Order By KjYear,Period"
- Set CxnrrecT = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If Not CxnrrecT.EOF Then CxnrrecT.MoveLast
- If Val(Cxnrrec!Period) = Val(CxnrrecT!Period) Then
- Cw_DataEnvi.DataConnect.Execute ("Delete Cask_Ledger where Period= 1 and KJYear=" & Val(Cxnrrec!KjYear) + 1)
- Sqlstr = "INSERT INTO Cask_Ledger (WhCode,WrappageCode,StatusName,StartQuan,kjyear,period) SELECT WhCode,WrappageCode,StatusName,Sum(StartQuan+AmountIn-AmountOut) as StartQuan," & Val(Cxnrrec!KjYear) + 1 & ",1 FROM Cask_Ledger where KjYear=" & Val(Cxnrrec!KjYear) & " and Period=" & Val(Cxnrrec!Period) & " GROUP BY WhCode,WrappageCode,StatusName"
- Cw_DataEnvi.DataConnect.Execute (Sqlstr)
- End If
- '回填结帐人
- Cw_DataEnvi.DataConnect.Execute ("Update Cask_HarvestIssueMain Set ChalkitupMan='" & Xtczy & "' Where BillType<>1 and HIDate Between '" & CDate(Trim(Cxnrrec!QSRQ)) & "' and '" & CDate(Trim(Cxnrrec!ZZRQ)) & "'")
- '回填会计日期
- Cw_DataEnvi.DataConnect.Execute ("Update Gy_Kjrlb Set CaskJzbz=1 where Period= " & Val(Trim(Cxnrrec!Period)) & " and KJYear=" & Val(Trim(Cxnrrec!KjYear)))
- Call th_focus
- Tsxx = "您已成功结帐! "
- Call Xtxxts(Tsxx, 0, 4)
- Exit Sub
- Swcwcl:
- Tsxx = "结帐过程中出现错误!请重试!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Sub
- End Sub
- Private Sub th_focus()
- Dim R_Temp As ADODB.Recordset
- Sqlstr = "SELECT * FROM Gy_Kjrlb Order By KjYear,Period"
- Set R_Temp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- For i = CzxsGrid.FixedRows To CzxsGrid.Rows - 1
- CzxsGrid.TextMatrix(i, Sydz("005", GridStr(), Szzls)) = R_Temp!CaskJzbz '结帐
- R_Temp.MoveNext
- Next i
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- Unload Me
- End Sub