上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:5k
源码类别:

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Begin VB.Form YM_FrmYmfjz 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "月末反结帐"
  5.    ClientHeight    =   2325
  6.    ClientLeft      =   2760
  7.    ClientTop       =   3750
  8.    ClientWidth     =   4320
  9.    Icon            =   "月末结帐_月末反结帐.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   2325
  14.    ScaleWidth      =   4320
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   1  '所有者中心
  17.    Begin VB.CommandButton cmdExecute 
  18.       Caption         =   "反结帐(&E)"
  19.       Height          =   300
  20.       Left            =   1710
  21.       TabIndex        =   1
  22.       Top             =   1740
  23.       Width           =   1120
  24.    End
  25.    Begin VB.CommandButton cmdCancel 
  26.       Caption         =   "关闭(&C)"
  27.       Height          =   300
  28.       Left            =   2910
  29.       TabIndex        =   0
  30.       Top             =   1740
  31.       Width           =   1120
  32.    End
  33.    Begin VB.Line Line1 
  34.       Index           =   2
  35.       X1              =   150
  36.       X2              =   4020
  37.       Y1              =   1290
  38.       Y2              =   1290
  39.    End
  40.    Begin VB.Line Line2 
  41.       BorderColor     =   &H00FFFFFF&
  42.       Index           =   2
  43.       X1              =   150
  44.       X2              =   4080
  45.       Y1              =   1320
  46.       Y2              =   1320
  47.    End
  48.    Begin VB.Label Lab_jzyf 
  49.       Caption         =   "2003年01月月末反结帐"
  50.       BeginProperty Font 
  51.          Name            =   "宋体"
  52.          Size            =   12
  53.          Charset         =   134
  54.          Weight          =   700
  55.          Underline       =   0   'False
  56.          Italic          =   0   'False
  57.          Strikethrough   =   0   'False
  58.       EndProperty
  59.       ForeColor       =   &H00000000&
  60.       Height          =   315
  61.       Left            =   870
  62.       TabIndex        =   2
  63.       Top             =   450
  64.       Width           =   2625
  65.    End
  66. End
  67. Attribute VB_Name = "YM_FrmYmfjz"
  68. Attribute VB_GlobalNameSpace = False
  69. Attribute VB_Creatable = False
  70. Attribute VB_PredeclaredId = True
  71. Attribute VB_Exposed = False
  72. '********************************************************************
  73. '*    模 块 名 称 :月末反结帐
  74. '*    功 能 描 述 :
  75. '*    程序员姓名  :奚俊峰
  76. '*    最后修改人  :奚俊峰
  77. '*    最后修改时间:2001-12-10
  78. '*    备        注:
  79. '********************************************************************
  80. Dim Int_Year As Integer    '当前会计年度
  81. Dim Int_Period As Integer  '当前会计期间
  82. Dim Ztxxrec As Recordset   '记录集
  83. Const str_Info = "百利/ERP5.0-财务总帐"
  84. Private Sub cmdCancel_Click()
  85.     Unload Me
  86. End Sub
  87. Private Sub cmdExecute_Click()
  88.     Dim str_Sql As String
  89.     Dim rs As Recordset
  90.     
  91.     '大于当前期间的凭证主表中存在记帐凭证,不能反结帐
  92.     str_Sql = "select 1 from cwzz_accvouchmain where year=" & Int_Year & " and period>" & Int_Period & " and bookflag=1"
  93.     
  94.     Set rs = Cw_DataEnvi.DataConnect.Execute(str_Sql)
  95.     
  96.     If Not rs.EOF Then
  97.         MsgBox "大于" & Int_Period & "的会计期间内存在已记帐凭证," & vbCrLf & "不能继续月末反结帐!", vbCritical, str_Info
  98.         Exit Sub
  99.     End If
  100.     
  101.     '年末结帐后,不能月末反结帐
  102.     If Int_Period = 12 Then
  103.         str_Sql = "select * from cwzz_accsum where year=" & (Int_Year + 1)
  104.         Set rs = Cw_DataEnvi.DataConnect.Execute(str_Sql)
  105.         If Not rs.EOF Then
  106.             MsgBox "已经年末结帐,不能月末反结帐!", vbInformation, str_Info
  107.             Exit Sub
  108.         End If
  109.     End If
  110.     
  111.     If Fun_JzCheck = True Then Unload Me
  112. End Sub
  113. Private Sub Form_Activate()
  114.     
  115.     '取出当前的会计期间
  116.     Set Ztxxrec = Cw_DataEnvi.DataConnect.Execute("Select isnull(max(kjyear),0),isnull(max(period),0) From Gy_kjrlb Where Cwzzjzbz=1 and kjyear=(select max(kjyear) from Gy_kjrlb where cwzzjzbz=1)")
  117.     Int_Year = Ztxxrec(0)
  118.     Int_Period = Ztxxrec(1)
  119.     
  120.     If Int_Year = 0 Then
  121.         MsgBox "此时不能月末反结帐!", vbInformation, str_Info
  122.         Unload Me
  123.         Exit Sub
  124.     Else
  125.         Lab_jzyf.Caption = Int_Year & "年" & Int_Period & "月月末反结帐"
  126.     End If
  127.     
  128. End Sub
  129. '月末反结帐过程处理
  130. Private Function Fun_JzCheck() As Boolean
  131.     
  132.     On Error GoTo ErrHandle
  133.     Cw_DataEnvi.DataConnect.BeginTrans
  134.     
  135.     
  136.     '置本会计期间结帐标识为 0
  137.     Cw_DataEnvi.DataConnect.Execute ("update gy_kjrlb set Cwzzjzbz=0 where kjYear=" & Int_Year & "and  period=" & Int_Period)
  138.     
  139.     Cw_DataEnvi.DataConnect.CommitTrans
  140.     
  141.     MsgBox "月末反结帐完毕!", vbInformation, str_Info
  142.     
  143.     Fun_JzCheck = True
  144.     Exit Function
  145. ErrHandle:
  146.     Fun_JzCheck = False
  147.     Cw_DataEnvi.DataConnect.RollbackTrans
  148. End Function