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

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{BEEECC20-4D5F-4F8B-BFDC-5D9B6FBDE09D}#1.0#0"; "vsflex8.ocx"
  3. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
  4. Begin VB.Form JZ_FrmJzcl 
  5.    Caption         =   "记帐处理"
  6.    ClientHeight    =   8250
  7.    ClientLeft      =   480
  8.    ClientTop       =   525
  9.    ClientWidth     =   11325
  10.    HelpContextID   =   5001
  11.    Icon            =   "记帐_记帐处理.frx":0000
  12.    KeyPreview      =   -1  'True
  13.    LinkTopic       =   "Form1"
  14.    ScaleHeight     =   8250
  15.    ScaleWidth      =   11325
  16.    StartUpPosition =   1  '所有者中心
  17.    Begin VB.PictureBox Pic_Title 
  18.       Height          =   1095
  19.       Left            =   0
  20.       Picture         =   "记帐_记帐处理.frx":1042
  21.       ScaleHeight     =   1035
  22.       ScaleWidth      =   11535
  23.       TabIndex        =   0
  24.       Top             =   540
  25.       Width           =   11595
  26.       Begin VB.Label Lab_TitleMess 
  27.          BackStyle       =   0  'Transparent
  28.          Caption         =   "(下面列表为当前记帐月所有已审核但未记帐凭证)"
  29.          ForeColor       =   &H00000000&
  30.          Height          =   225
  31.          Index           =   1
  32.          Left            =   2790
  33.          TabIndex        =   9
  34.          Top             =   780
  35.          Width           =   4005
  36.       End
  37.       Begin VB.Label tsLabel 
  38.          AutoSize        =   -1  'True
  39.          BackColor       =   &H80000018&
  40.          BackStyle       =   0  'Transparent
  41.          Caption         =   "记帐处理"
  42.          BeginProperty Font 
  43.             Name            =   "宋体"
  44.             Size            =   14.25
  45.             Charset         =   134
  46.             Weight          =   700
  47.             Underline       =   0   'False
  48.             Italic          =   0   'False
  49.             Strikethrough   =   0   'False
  50.          EndProperty
  51.          ForeColor       =   &H00000000&
  52.          Height          =   285
  53.          Index           =   4
  54.          Left            =   660
  55.          TabIndex        =   3
  56.          Top             =   180
  57.          Width           =   1200
  58.       End
  59.       Begin VB.Label Lab_TitleMess 
  60.          BackStyle       =   0  'Transparent
  61.          Caption         =   "会计期间:"
  62.          Height          =   225
  63.          Index           =   0
  64.          Left            =   1080
  65.          TabIndex        =   2
  66.          Top             =   780
  67.          Width           =   915
  68.       End
  69.       Begin VB.Label Lab_TitleText 
  70.          BackStyle       =   0  'Transparent
  71.          ForeColor       =   &H00000000&
  72.          Height          =   225
  73.          Left            =   2040
  74.          TabIndex        =   1
  75.          Top             =   780
  76.          Width           =   675
  77.       End
  78.    End
  79.    Begin VSFlex8Ctl.VSFlexGrid CxbbGrid 
  80.       Height          =   6705
  81.       Left            =   0
  82.       TabIndex        =   4
  83.       Top             =   1650
  84.       Width           =   11715
  85.       _cx             =   5080
  86.       _cy             =   5080
  87.       Appearance      =   1
  88.       BorderStyle     =   1
  89.       Enabled         =   -1  'True
  90.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  91.          Name            =   "宋体"
  92.          Size            =   9
  93.          Charset         =   134
  94.          Weight          =   400
  95.          Underline       =   0   'False
  96.          Italic          =   0   'False
  97.          Strikethrough   =   0   'False
  98.       EndProperty
  99.       MousePointer    =   0
  100.       BackColor       =   16777215
  101.       ForeColor       =   -2147483640
  102.       BackColorFixed  =   13826538
  103.       ForeColorFixed  =   -2147483630
  104.       BackColorSel    =   -2147483635
  105.       ForeColorSel    =   -2147483634
  106.       BackColorBkg    =   -2147483636
  107.       BackColorAlternate=   16777215
  108.       GridColor       =   -2147483633
  109.       GridColorFixed  =   -2147483632
  110.       TreeColor       =   -2147483632
  111.       FloodColor      =   192
  112.       SheetBorder     =   -2147483642
  113.       FocusRect       =   1
  114.       HighLight       =   1
  115.       AllowSelection  =   -1  'True
  116.       AllowBigSelection=   -1  'True
  117.       AllowUserResizing=   0
  118.       SelectionMode   =   0
  119.       GridLines       =   1
  120.       GridLinesFixed  =   2
  121.       GridLineWidth   =   1
  122.       Rows            =   50
  123.       Cols            =   10
  124.       FixedRows       =   1
  125.       FixedCols       =   1
  126.       RowHeightMin    =   0
  127.       RowHeightMax    =   0
  128.       ColWidthMin     =   0
  129.       ColWidthMax     =   0
  130.       ExtendLastCol   =   0   'False
  131.       FormatString    =   ""
  132.       ScrollTrack     =   0   'False
  133.       ScrollBars      =   3
  134.       ScrollTips      =   0   'False
  135.       MergeCells      =   0
  136.       MergeCompare    =   0
  137.       AutoResize      =   -1  'True
  138.       AutoSizeMode    =   0
  139.       AutoSearch      =   0
  140.       AutoSearchDelay =   2
  141.       MultiTotals     =   -1  'True
  142.       SubtotalPosition=   1
  143.       OutlineBar      =   0
  144.       OutlineCol      =   0
  145.       Ellipsis        =   0
  146.       ExplorerBar     =   0
  147.       PicturesOver    =   0   'False
  148.       FillStyle       =   0
  149.       RightToLeft     =   0   'False
  150.       PictureType     =   0
  151.       TabBehavior     =   0
  152.       OwnerDraw       =   0
  153.       Editable        =   0
  154.       ShowComboButton =   1
  155.       WordWrap        =   0   'False
  156.       TextStyle       =   0
  157.       TextStyleFixed  =   0
  158.       OleDragMode     =   0
  159.       OleDropMode     =   0
  160.       DataMode        =   0
  161.       VirtualData     =   -1  'True
  162.       DataMember      =   ""
  163.       ComboSearch     =   3
  164.       AutoSizeMouse   =   -1  'True
  165.       FrozenRows      =   0
  166.       FrozenCols      =   0
  167.       AllowUserFreezing=   0
  168.       BackColorFrozen =   0
  169.       ForeColorFrozen =   0
  170.       WallPaperAlignment=   9
  171.       AccessibleName  =   ""
  172.       AccessibleDescription=   ""
  173.       AccessibleValue =   ""
  174.       AccessibleRole  =   24
  175.       Begin VB.Frame Fra_Book 
  176.          BackColor       =   &H00C0C0C0&
  177.          Caption         =   "系统正在记帐,请稍候..."
  178.          ForeColor       =   &H00FF0000&
  179.          Height          =   1515
  180.          Left            =   1530
  181.          TabIndex        =   7
  182.          Top             =   990
  183.          Visible         =   0   'False
  184.          Width           =   8025
  185.          Begin MSComctlLib.ProgressBar Prg_Book 
  186.             Height          =   285
  187.             Left            =   30
  188.             TabIndex        =   8
  189.             Top             =   1020
  190.             Width           =   7965
  191.             _ExtentX        =   14049
  192.             _ExtentY        =   503
  193.             _Version        =   393216
  194.             BorderStyle     =   1
  195.             Appearance      =   1
  196.          End
  197.          Begin VB.Label Label1 
  198.             BackColor       =   &H00C0C0C0&
  199.             Caption         =   "正在记帐科目"
  200.             Height          =   255
  201.             Left            =   2400
  202.             TabIndex        =   11
  203.             Top             =   600
  204.             Width           =   1215
  205.          End
  206.          Begin VB.Label Lab_Ccode 
  207.             BackColor       =   &H00C0C0C0&
  208.             ForeColor       =   &H00FF0000&
  209.             Height          =   255
  210.             Left            =   3720
  211.             TabIndex        =   10
  212.             Top             =   600
  213.             Width           =   2175
  214.          End
  215.       End
  216.    End
  217.    Begin MSComctlLib.Toolbar SzToolbar 
  218.       Align           =   1  'Align Top
  219.       Height          =   555
  220.       Left            =   0
  221.       TabIndex        =   5
  222.       Top             =   0
  223.       Width           =   11325
  224.       _ExtentX        =   19976
  225.       _ExtentY        =   979
  226.       ButtonWidth     =   820
  227.       ButtonHeight    =   926
  228.       AllowCustomize  =   0   'False
  229.       Appearance      =   1
  230.       Style           =   1
  231.       ImageList       =   "ImageList1"
  232.       _Version        =   393216
  233.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  234.          NumButtons      =   8
  235.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  236.             Caption         =   "设置"
  237.             Key             =   "ymsz"
  238.             ImageKey        =   "sz"
  239.          EndProperty
  240.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  241.             Caption         =   "打印"
  242.             Key             =   "dy"
  243.             ImageKey        =   "dy"
  244.          EndProperty
  245.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  246.             Caption         =   "预览"
  247.             Key             =   "yl"
  248.             ImageKey        =   "yl"
  249.          EndProperty
  250.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  251.             Style           =   3
  252.          EndProperty
  253.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  254.             Caption         =   "记帐"
  255.             Key             =   "jz"
  256.             ImageKey        =   "jz"
  257.          EndProperty
  258.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  259.             Style           =   3
  260.          EndProperty
  261.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  262.             Caption         =   "帮助"
  263.             Key             =   "bz"
  264.             ImageKey        =   "bz"
  265.          EndProperty
  266.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  267.             Caption         =   "退出"
  268.             Key             =   "fh"
  269.             ImageKey        =   "tc"
  270.          EndProperty
  271.       EndProperty
  272.       BorderStyle     =   1
  273.       Begin MSComctlLib.ImageList ImageList1 
  274.          Left            =   6540
  275.          Top             =   0
  276.          _ExtentX        =   1005
  277.          _ExtentY        =   1005
  278.          BackColor       =   -2147483643
  279.          ImageWidth      =   16
  280.          ImageHeight     =   16
  281.          MaskColor       =   12632256
  282.          _Version        =   393216
  283.          BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  284.             NumListImages   =   30
  285.             BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  286.                Picture         =   "记帐_记帐处理.frx":35106
  287.                Key             =   "sz"
  288.             EndProperty
  289.             BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  290.                Picture         =   "记帐_记帐处理.frx":354A0
  291.                Key             =   "dy"
  292.             EndProperty
  293.             BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  294.                Picture         =   "记帐_记帐处理.frx":3583A
  295.                Key             =   "yl"
  296.             EndProperty
  297.             BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  298.                Picture         =   "记帐_记帐处理.frx":35BD4
  299.                Key             =   "xg"
  300.             EndProperty
  301.             BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  302.                Picture         =   "记帐_记帐处理.frx":35F6E
  303.                Key             =   "zh"
  304.             EndProperty
  305.             BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  306.                Picture         =   "记帐_记帐处理.frx":36308
  307.                Key             =   "sh"
  308.             EndProperty
  309.             BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  310.                Picture         =   "记帐_记帐处理.frx":366A2
  311.                Key             =   "bc"
  312.             EndProperty
  313.             BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  314.                Picture         =   "记帐_记帐处理.frx":36A3C
  315.                Key             =   "fq"
  316.             EndProperty
  317.             BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  318.                Picture         =   "记帐_记帐处理.frx":36DD6
  319.                Key             =   "bz"
  320.             EndProperty
  321.             BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  322.                Picture         =   "记帐_记帐处理.frx":37170
  323.                Key             =   "tc"
  324.             EndProperty
  325.             BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  326.                Picture         =   "记帐_记帐处理.frx":3750A
  327.                Key             =   "bcgs"
  328.             EndProperty
  329.             BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  330.                Picture         =   "记帐_记帐处理.frx":378A4
  331.                Key             =   "mrlk"
  332.             EndProperty
  333.             BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  334.                Picture         =   "记帐_记帐处理.frx":37C3E
  335.                Key             =   "xsxm"
  336.             EndProperty
  337.             BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  338.                Picture         =   "记帐_记帐处理.frx":37FD8
  339.                Key             =   "first"
  340.             EndProperty
  341.             BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  342.                Picture         =   "记帐_记帐处理.frx":38372
  343.                Key             =   "prev"
  344.             EndProperty
  345.             BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  346.                Picture         =   "记帐_记帐处理.frx":3870C
  347.                Key             =   "next"
  348.             EndProperty
  349.             BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  350.                Picture         =   "记帐_记帐处理.frx":38AA6
  351.                Key             =   "last"
  352.             EndProperty
  353.             BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  354.                Picture         =   "记帐_记帐处理.frx":38E40
  355.                Key             =   "xx"
  356.             EndProperty
  357.             BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  358.                Picture         =   "记帐_记帐处理.frx":391DA
  359.                Key             =   "define"
  360.             EndProperty
  361.             BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  362.                Picture         =   "记帐_记帐处理.frx":39574
  363.                Key             =   "exec"
  364.             EndProperty
  365.             BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  366.                Picture         =   "记帐_记帐处理.frx":3990E
  367.                Key             =   "xz"
  368.             EndProperty
  369.             BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  370.                Picture         =   "记帐_记帐处理.frx":39CA8
  371.                Key             =   "sc"
  372.             EndProperty
  373.             BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  374.                Picture         =   "记帐_记帐处理.frx":3A042
  375.                Key             =   "sx"
  376.             EndProperty
  377.             BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  378.                Picture         =   "记帐_记帐处理.frx":3A3DC
  379.                Key             =   "cx"
  380.             EndProperty
  381.             BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  382.                Picture         =   "记帐_记帐处理.frx":3A776
  383.                Key             =   "zd"
  384.             EndProperty
  385.             BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  386.                Picture         =   "记帐_记帐处理.frx":3AB10
  387.                Key             =   "dz"
  388.             EndProperty
  389.             BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  390.                Picture         =   "记帐_记帐处理.frx":3AEAA
  391.                Key             =   "ph"
  392.             EndProperty
  393.             BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  394.                Picture         =   "记帐_记帐处理.frx":3B244
  395.                Key             =   "fz"
  396.             EndProperty
  397.             BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  398.                Picture         =   "记帐_记帐处理.frx":3B5DE
  399.                Key             =   "dw"
  400.             EndProperty
  401.             BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  402.                Picture         =   "记帐_记帐处理.frx":3B978
  403.                Key             =   "jz"
  404.             EndProperty
  405.          EndProperty
  406.       End
  407.       Begin VB.Timer Timer1 
  408.          Interval        =   1
  409.          Left            =   5940
  410.          Top             =   120
  411.       End
  412.       Begin MSComctlLib.Toolbar GsToolbar 
  413.          Height          =   525
  414.          Left            =   8820
  415.          TabIndex        =   6
  416.          Top             =   0
  417.          Width           =   2505
  418.          _ExtentX        =   4419
  419.          _ExtentY        =   926
  420.          ButtonWidth     =   1455
  421.          ButtonHeight    =   926
  422.          AllowCustomize  =   0   'False
  423.          Appearance      =   1
  424.          Style           =   1
  425.          ImageList       =   "ImageList1"
  426.          _Version        =   393216
  427.          BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  428.             NumButtons      =   3
  429.             BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  430.                Caption         =   "保存格式"
  431.                Key             =   "bcgs"
  432.                ImageKey        =   "bcgs"
  433.             EndProperty
  434.             BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  435.                Caption         =   "默认列宽"
  436.                Key             =   "hfmrgs"
  437.                ImageKey        =   "mrlk"
  438.             EndProperty
  439.             BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  440.                Caption         =   "显示项目"
  441.                Key             =   "szxsxm"
  442.                ImageKey        =   "xsxm"
  443.             EndProperty
  444.          EndProperty
  445.       End
  446.    End
  447. End
  448. Attribute VB_Name = "JZ_FrmJzcl"
  449. Attribute VB_GlobalNameSpace = False
  450. Attribute VB_Creatable = False
  451. Attribute VB_PredeclaredId = True
  452. Attribute VB_Exposed = False
  453. '*********************************************************************
  454. '*    模 块 名 称 :记帐处理
  455. '*    功 能 描 述 :完成对已审核但未记帐的凭证的记帐
  456. '*    程序员姓名  :张建忠
  457. '*    最后修改人  :张建忠
  458. '*    最后修改时间:2001/03/08
  459. '*    备        注:由于凭证记帐过程复杂,本程序没有使用存储过程,因此
  460. '*                 记帐速度较慢,有待于以后改进
  461. '*********************************************************************
  462. Dim ReportTitle As String                '报表主标题
  463. Dim Int_CodeScheme() As Integer          '会计科目编码方案
  464. Dim Int_CodeLev As Integer               '会计科目编码级数
  465. '以下为固定使用变量
  466. Dim Dyymctbl As New DY_Dyymsz            '打印页面窗体变量
  467. Dim GridCode As String                   '显示网格网格代码
  468. Dim GridInf() As Variant                 '整个网格设置信息
  469. Dim Tsxx As String                       '系统提示信息
  470. Dim Qslz As Long                         '网格隐藏(非操作显示)列数
  471. Dim Sjhgd As Double                      '网格数据行高度
  472. Dim Sfxshjwg As Boolean                  '是否显示合计网格
  473. Dim GridBoolean() As Boolean             '网格列信息(布尔型)
  474. Dim GridStr()  As String                 '网格列信息(字符型)
  475. Dim GridInt() As Integer                 '网格列信息(整型)
  476. Dim Szzls As Integer                     '数组总列数(网格列数-1)
  477. Dim Int_DqYear As Integer                '系统当前会计年度
  478. Dim Int_DqPeriod As Integer              '系统当前会计期间
  479. Private Sub Form_Resize()                '根据窗体大小来调整网格,标题栏大小
  480.     On Error Resume Next
  481.     With CxbbGrid
  482.         .Width = Me.Width - 160
  483.         .Height = Me.Height - .Top - 400
  484.     End With
  485.     With Pic_Title
  486.         .Width = Me.Width - 160
  487.     End With
  488.     
  489.     GsToolbar.Left = Me.Width - GsToolbar.Width - 150
  490. End Sub
  491. Private Sub Form_Load()                                                   '窗体装入
  492.     
  493.     '调入打印页面设置窗体
  494.     
  495.     XtReportCode = "Cwzz_jzcl"
  496.     Load Dyymctbl
  497.     ReportTitle = "记帐凭证列表"
  498.     
  499.     '调整标题栏及网格、格式工具条位置
  500.     Pic_Title.Left = 40
  501.     Pic_Title.Top = SzToolbar.Top + SzToolbar.Height - 10
  502.     CxbbGrid.Left = Pic_Title.Left
  503.     CxbbGrid.Top = Pic_Title.Top + Pic_Title.Height + 20
  504.     
  505.     '调 入 网 格
  506.     GridCode = "Cwzz_jzcl"
  507.     Call BzWgcsh(CxbbGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  508.     
  509.     Qslz = GridInf(1)
  510.     Sjhgd = GridInf(2)
  511.     Sfxshjwg = GridInf(7)
  512.     Szzls = CxbbGrid.Cols - 1
  513.     
  514.     '读入科目编码方案
  515.     Call Sub_CodeScheme("Cwzz_kmcode", Int_CodeLev, Int_CodeScheme())
  516.     
  517.     '调整标题位置
  518.     SetTitlePos tsLabel(4)
  519.     
  520. End Sub
  521. Private Sub Form_Unload(Cancel As Integer)                                  '窗体卸载
  522.     '卸载条件窗体
  523.     PZ_FrmPzcxtj.UnloadCheck.Value = 1
  524.     Unload PZ_FrmPzcxtj
  525.     '卸载打印页面设置窗体
  526.     Unload Dyymctbl
  527. End Sub
  528. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)       '网格格式调整
  529.     Select Case Button.Key
  530.     Case "bcgs"                                          '保存表格格式
  531.         Call Bcwggs(CxbbGrid, GridCode, GridStr)
  532.     Case "hfmrgs"                                        '恢复默认格式
  533.         Call Hfmrgs(CxbbGrid, GridCode, GridStr)
  534.     Case "szxsxm"                                        '设置显示项目
  535.         Call Szxsxm(CxbbGrid, GridCode)
  536.     End Select
  537. End Sub
  538. Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
  539.     Select Case Button.Key
  540.     Case "ymsz"                                          '页面设置
  541.         Dyymctbl.Show 1
  542.     Case "yl"                                            '预 览
  543.         Call bbyl(True)
  544.     Case "dy"                                            '打 印
  545.         Call bbyl(False)
  546.     Case "jz"                                            '记 帐
  547.         Call Sub_Book
  548.     Case "sx"                                            '刷 新
  549.         Call Timer1_Timer
  550.     Case "bz"                                            '帮 助
  551.         Call F1bz
  552.     Case "fh"                                            '退 出
  553.         Unload Me
  554.     End Select
  555. End Sub
  556. Private Sub Timer1_Timer()                                 '在窗体激活后调入查询程序
  557.     Timer1.Enabled = False
  558.     
  559.     CxbbGrid.Redraw = True
  560.     
  561.     '加快显示速度
  562.     CxbbGrid.Redraw = False
  563.     
  564.     '生成查询结果
  565.     Call Sub_Query
  566.     
  567.     CxbbGrid.Redraw = True
  568. End Sub
  569. Private Sub Sub_Query()                                    '生成查询结果
  570.     Dim Rec_Query As New ADODB.Recordset        '查询结果动态集
  571.     Dim RecTemp As New ADODB.Recordset          '临时使用动态集
  572.     Dim Str_QueryCondi As String                '用户录入查询条件
  573.     Dim Sqlstr As String                        '查询字符串
  574.     Dim Coljsq As Long                          '网格列计数器
  575.     Dim Jsqte As Long                           '临时动态计数器
  576.     Dim Int_LevTe As Integer                    '编码级数计数器
  577.     Dim Str_Parent As String                    '上级科目号
  578.     
  579.     '以下为用户自定义部分[
  580.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select * From Gy_kjrlb where cwzzjzbz='0' order by kjyear,period")
  581.     If Not RecTemp.EOF Then
  582.         Int_DqYear = RecTemp.Fields("KjYear")
  583.         Int_DqPeriod = RecTemp.Fields("period")
  584.         Lab_TitleText.Caption = Mid(Trim(Str(10000 + Int_DqYear)), 2, 4) + "." + Mid(Trim(Str(100 + Int_DqPeriod)), 2, 2)
  585.     End If
  586.     
  587.     '筛选所有当前会计期间已审核但未记帐凭证
  588.     
  589.     Sqlstr = "SELECT A.*,Cwzz_AccVouchMain.Ddate,Cwzz_AccVouchMain.VouchClassCode, Cwzz_AccVouchMain.VouchNo,Cwzz_AccVouchMain.Bill, Cwzz_AccVouchMain.Checker" & _
  590.     " FROM (SELECT VouchID, SUM(jfje) Jfjehj, SUM(Dfje) Dfjehj From Cwzz_V_AccVouch WHERE CheckFlag=1 and BookFlag=0 and Year =" & Int_DqYear & " AND Period = " & Int_DqPeriod & _
  591.     " GROUP BY VouchID) A LEFT OUTER JOIN " & _
  592.     " Cwzz_AccVouchMain ON A.VouchID = Cwzz_AccVouchMain.VouchId Order by VouchClassCode,VouchNo"
  593.     
  594.     Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  595.     With Rec_Query
  596.         CxbbGrid.Rows = CxbbGrid.FixedRows
  597.         CxbbGrid.Rows = CxbbGrid.FixedRows + .RecordCount
  598.         Jsqte = CxbbGrid.FixedRows
  599.         
  600.         If .EOF Then
  601.             SzToolbar.Buttons("jz").Enabled = False
  602.         End If
  603.         
  604.         Do While Not .EOF
  605.             If Jsqte >= CxbbGrid.Rows Then
  606.                 CxbbGrid.AddItem ""
  607.             End If
  608.             
  609.             CxbbGrid.TextMatrix(Jsqte, 0) = .Fields("VouchID")                                               '凭证ID
  610.             
  611.             CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = .Fields("Ddate")                      '制单日期
  612.             CxbbGrid.TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("VouchClassCode") & "") + "-" + Mid(Trim(Str(10000 + .Fields("VouchNo"))), 2, 4) '凭证字号
  613.             If .Fields("Jfjehj") <> 0 Then                                                                   '借方金额合计
  614.                 CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = Trim(Str(.Fields("Jfjehj")))
  615.             End If
  616.             If .Fields("Dfjehj") <> 0 Then                                                                    '贷方金额合计
  617.                 CxbbGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Trim(Str(.Fields("Dfjehj")))
  618.             End If
  619.             CxbbGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("Bill") & "")             '制单人
  620.             CxbbGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("Checker") & "")          '审核人
  621.             
  622.             CxbbGrid.RowHeight(Jsqte) = Sjhgd
  623.             
  624.             Jsqte = Jsqte + 1
  625.             .MoveNext
  626.             
  627.         Loop
  628.         
  629.     End With
  630.     
  631.     ']以上为用户自定义部分
  632.     
  633. End Sub
  634. Private Sub Sub_Book()                                                      '记帐处理
  635.     Dim Lng_Rowjsq As Long                      '网格行值计数器
  636.     Dim Int_ReccordJsq As Integer               '记帐记录条数计数器
  637.     Dim Int_LevTe As Integer                    '编码级数计数器
  638.     Dim Str_Parent As String                    '上级科目号
  639.     Dim Yhanswer As Integer                     '回答是否确认
  640.     Dim Sqlstr As String                        '查询字符串
  641.     Dim RecTemp As New ADODB.Recordset          '临时使用动态集
  642.     Dim Rec_AccSum As New ADODB.Recordset       '科目总帐动态集
  643.     Dim Rec_AccSumAssi As New ADODB.Recordset   '科目辅助帐动态集
  644.     Dim Int_PeriodTe As Integer                 '临时会计期间变量
  645.     
  646.     
  647.     If FinishInit = False Then
  648.         Tsxx = "期初余额设置未完成!"
  649.         Call Xtxxts(Tsxx, 0, 4)
  650.         
  651.         Exit Sub
  652.     End If
  653.     '用户确认是否开始记帐
  654.     Tsxx = "请确认是否开始记帐?"
  655.     Yhanswer = Xtxxts(Tsxx, 2, 2)
  656.     If Yhanswer = 2 Then
  657.         Exit Sub
  658.     End If
  659.     
  660.     '打开科目总帐动态集
  661.     With Rec_AccSum
  662.         If .State = 1 Then .Close
  663.         .Open "SELECT Cwzz_AccSum.* From Cwzz_AccSum WHERE Year =" & Int_DqYear & " AND Period = " & Int_DqPeriod, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  664.     End With
  665.     
  666.     '记帐主要处理过程
  667.     
  668.     '筛选符合条件记录并汇总
  669.     
  670.     Sqlstr = "SELECT Ccode, PersonCode,DeptCode,CusCode,SupplierCode,ItemClassCode,ItemCode,SUM(Wbjfje) AS WbjfjeHj, SUM(Wbdfje) AS Wbdfjehj, SUM(Jfje) AS Jfjehj," & _
  671.     " SUM(Dfje) AS Dfjehj, SUM(Jfsl) AS Jfslhj, SUM(Dfsl) AS Dfslhj,Sum(ItemJfsl) AS ItemJfslhj,Sum(ItemDfsl) AS ItemDfslhj" & _
  672.     " From Cwzz_V_AccVouch " & _
  673.     " Where Year = " & Int_DqYear & " And Period = " & Int_DqPeriod & " And checkflag = 1 And bookflag = 0 " & _
  674.     " GROUP BY Ccode,PersonCode,DeptCode,CusCode,SupplierCode,ItemClassCode,ItemCode ORDER BY Ccode"
  675.     
  676.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  677.     
  678.     If RecTemp.EOF Then
  679.         Tsxx = "无符合条件记帐记录!"
  680.         Call Xtxxts(Tsxx, 0, 4)
  681.         Exit Sub
  682.     End If
  683.     
  684.     '初始化进度情况
  685.     Prg_Book.Max = RecTemp.RecordCount
  686.     Prg_Book.Min = 0
  687.     Prg_Book.Value = 0
  688.     Fra_Book.Visible = True
  689.     Fra_Book.Refresh
  690.     
  691.     '开始记帐
  692.     
  693.     On Error GoTo Swcwcl
  694.     
  695.     Cw_DataEnvi.DataConnect.BeginTrans
  696.     
  697.     Do While Not RecTemp.EOF
  698.         
  699.         '显示记帐科目
  700.         Lab_Ccode.Caption = Trim(RecTemp.Fields("Ccode")) & "--" & Str(Prg_Book.Value)
  701.         Lab_Ccode.Refresh
  702.         
  703.         '1.登记总帐(注意需要对其上级科目记帐)
  704.         
  705.         Int_LevTe = 1
  706.         
  707.         Do While True
  708.             Str_Parent = Trim(Mid(Trim(RecTemp.Fields("Ccode")), 1, Int_CodeScheme(Int_LevTe)))
  709.             
  710.             With Rec_AccSum
  711.                 
  712.                 If Not (.EOF And .BOF) Then
  713.                     .MoveFirst
  714.                 End If
  715.                 
  716.                 '判断记帐科目是否存在,如存在则累加,否则插入新记录
  717.                 
  718.                 .Find "Ccode ='" & Str_Parent & "'"
  719.                 
  720.                 If Not Rec_AccSum.EOF Then
  721.                     
  722.                     .Fields("Mjje") = .Fields("Mjje") + RecTemp.Fields("Jfjehj")               '本月借方金额合计
  723.                     .Fields("Mdje") = .Fields("Mdje") + RecTemp.Fields("Dfjehj")               '本月贷方金额合计
  724.                     .Fields("Byjfljje") = .Fields("Byjfljje") + RecTemp.Fields("Jfjehj")       '本年借方金额累计
  725.                     .Fields("Bydfljje") = .Fields("Bydfljje") + RecTemp.Fields("Dfjehj")       '本月贷方金额累计
  726.                     .Fields("Qmye") = .Fields("Qcye") + .Fields("Mjje") - .Fields("Mdje")      '本月期末余额
  727.                     
  728.                     '只有末级科目才进行数量及外币累加
  729.                     If Str_Parent = Trim(RecTemp.Fields("Ccode")) Then
  730.                         .Fields("Mjsl") = .Fields("Mjsl") + RecTemp.Fields("Jfslhj") + 0             '本月借方数量合计
  731.                         .Fields("Mdsl") = .Fields("Mdsl") + RecTemp.Fields("Dfslhj") + 0             '本月贷方数量合计
  732.                         .Fields("Byjfljsl") = .Fields("Byjfljsl") + RecTemp.Fields("Jfslhj") + 0     '本年借方数量累计
  733.                         .Fields("Bydfljsl") = .Fields("Bydfljsl") + RecTemp.Fields("Dfslhj") + 0     '本月贷方数量累计
  734.                         .Fields("Qmsl") = .Fields("Qcsl") + .Fields("Mjsl") - .Fields("Mdsl") + 0    '本月数量余额
  735.                         
  736.                         .Fields("Mjwb") = .Fields("Mjwb") + RecTemp.Fields("Wbjfjehj")               '本月借方外币合计
  737.                         .Fields("Mdwb") = .Fields("Mdwb") + RecTemp.Fields("Wbdfjehj")               '本月贷方外币合计
  738.                         .Fields("Byjfljwb") = .Fields("Byjfljwb") + RecTemp.Fields("Wbjfjehj")       '本年借方外币累计
  739.                         .Fields("Bydfljwb") = .Fields("Bydfljwb") + RecTemp.Fields("Wbdfjehj")       '本月贷方外币累计
  740.                         .Fields("Qmwb") = .Fields("Qcwb") + .Fields("Mjwb") - .Fields("Mdwb")        '本月外币余额
  741.                     End If
  742.                     
  743.                     Sqlstr = "Update Cwzz_AccSum Set Qcye=" & .Fields("Qmye") & ",Byjfljje=" & .Fields("Byjfljje") & ",Bydfljje=" & .Fields("Bydfljje") & ",Qmye=" & .Fields("Qmye") & _
  744.                     ",Qcsl=" & .Fields("Qmsl") + 0 & ",Byjfljsl=" & .Fields("Byjfljsl") + 0 & ",Bydfljsl=" & .Fields("Bydfljsl") + 0 & ",Qmsl=" & .Fields("Qmsl") + 0 & _
  745.                     ",Qcwb=" & .Fields("Qmwb") + 0 & ",Byjfljwb=" & .Fields("Byjfljwb") + 0 & ",Bydfljwb=" & .Fields("Bydfljwb") + 0 & ",Qmwb=" & .Fields("Qmwb") + 0 & _
  746.                     " Where Ccode='" & Str_Parent & "' And Year=" & Int_DqYear & " And Period > " & Int_DqPeriod
  747.                     
  748.                     Cw_DataEnvi.DataConnect.Execute (Sqlstr)
  749.                     
  750.                     
  751.                 Else
  752.                     .AddNew
  753.                     .Fields("Ccode") = Str_Parent                                            '科目编码
  754.                     .Fields("Year") = Int_DqYear                                             '会计年度
  755.                     .Fields("Period") = Int_DqPeriod                                         '会计期间
  756.                     .Fields("Mjje") = RecTemp.Fields("Jfjehj")                               '本月借方金额合计
  757.                     .Fields("Mdje") = RecTemp.Fields("Dfjehj")                               '本月贷方金额合计
  758.                     .Fields("Byjfljje") = RecTemp.Fields("Jfjehj")                           '本年借方金额累计
  759.                     .Fields("Bydfljje") = RecTemp.Fields("Dfjehj")                           '本月贷方金额累计
  760.                     .Fields("Qmye") = .Fields("Mjje") - .Fields("Mdje")                      '本月期末余额
  761.                     
  762.                     
  763.                     '只有末级科目才进行数量及外币累加
  764.                     If Str_Parent = Trim(RecTemp.Fields("Ccode")) Then
  765.                         .Fields("Mjsl") = RecTemp.Fields("Jfslhj") + 0                       '本月借方数量合计
  766.                         .Fields("Mdsl") = RecTemp.Fields("Dfslhj") + 0                       '本月贷方数量合计
  767.                         .Fields("Byjfljsl") = RecTemp.Fields("Jfslhj") + 0                   '本年借方数量累计
  768.                         .Fields("Bydfljsl") = RecTemp.Fields("Dfslhj") + 0                   '本年贷方数量累计
  769.                         .Fields("Qmsl") = .Fields("Mjsl") - .Fields("Mdsl")                  '本月数量余额
  770.                         
  771.                         
  772.                         .Fields("Mjwb") = RecTemp.Fields("Wbjfjehj")                         '本月借方外币合计
  773.                         .Fields("Mdwb") = RecTemp.Fields("Wbdfjehj")                         '本月贷方外币合计
  774.                         .Fields("Byjfljwb") = RecTemp.Fields("Wbjfjehj")                     '本年借方外币累计
  775.                         .Fields("Bydfljwb") = RecTemp.Fields("Wbdfjehj")                     '本年贷方外币累计
  776.                         .Fields("Qmwb") = .Fields("Mjwb") - .Fields("Mdwb")                  '本月外币余额
  777.                         
  778.                     End If
  779.                     
  780.                     '添加并更新其他会计期间数据(按12个会计期间)
  781.                     For Int_PeriodTe = 1 To 12
  782.                         If Int_PeriodTe <> Int_DqPeriod Then
  783.                             Sqlstr = "Insert Into Cwzz_AccSum (Ccode,Year,Period) values ('" & Str_Parent & "'," & Int_DqYear & "," & Int_PeriodTe & ")"
  784.                             Cw_DataEnvi.DataConnect.Execute (Sqlstr)
  785.                         End If
  786.                     Next Int_PeriodTe
  787.                     
  788.                     Sqlstr = "Update Cwzz_AccSum Set Qcye=" & .Fields("Qmye") & ",Byjfljje=" & .Fields("Byjfljje") & ",Bydfljje=" & .Fields("Bydfljje") & ",Qmye=" & .Fields("Qmye") & _
  789.                     ",Qcsl=" & .Fields("Qmsl") + 0 & ",Byjfljsl=" & .Fields("Byjfljsl") + 0 & ",Bydfljsl=" & .Fields("Bydfljsl") + 0 & ",Qmsl=" & .Fields("Qmsl") + 0 & _
  790.                     ",Qcwb=" & .Fields("Qmwb") + 0 & ",Byjfljwb=" & .Fields("Byjfljwb") + 0 & ",Bydfljwb=" & .Fields("Bydfljwb") + 0 & ",Qmwb=" & .Fields("Qmwb") + 0 & _
  791.                     " Where Ccode='" & Str_Parent & "' And Year=" & Int_DqYear & " And Period > " & Int_DqPeriod
  792.                     
  793.                     Cw_DataEnvi.DataConnect.Execute (Sqlstr)
  794.                     
  795.                 End If
  796.                 
  797.                 .Update
  798.             End With
  799.             
  800.             If Str_Parent = Trim(RecTemp.Fields("Ccode")) Then
  801.                 Exit Do
  802.             End If
  803.             
  804.             Int_LevTe = Int_LevTe + 1
  805.             
  806.         Loop
  807.         
  808.         '2.登记辅助帐
  809.         
  810.         With Rec_AccSumAssi
  811.             
  812.             '2.1 如果有辅助项不为空则登记辅助帐
  813.             If Trim(RecTemp.Fields("DeptCode") & "") <> "" Or Trim(RecTemp.Fields("PersonCode") & "") <> "" Or Trim(RecTemp.Fields("CusCode") & "") <> "" Or Trim(RecTemp.Fields("SupplierCode") & "") <> "" Or Trim(RecTemp.Fields("ItemClassCode") & "") <> "" Or Trim(RecTemp.Fields("ItemCode") & "") <> "" Then
  814.                 
  815.                 If .State = 1 Then .Close
  816.                 Sqlstr = "SELECT Cwzz_AccSumAssi.* From Cwzz_AccSumAssi WHERE Year =" & Int_DqYear & " AND Period = " & Int_DqPeriod & " And Ccode ='" & Trim(RecTemp.Fields("Ccode")) & "'" & _
  817.                 " And DeptCode='" & Trim(RecTemp.Fields("DeptCode")) & "' And PersonCode='" & Trim(RecTemp.Fields("PersonCode")) & "' And CusCode='" & Trim(RecTemp.Fields("CusCode")) & "'" & _
  818.                 " And SupplierCode='" & Trim(RecTemp.Fields("SupplierCode")) & "' And ItemClassCode='" & Trim(RecTemp.Fields("ItemClassCode")) & "' And ItemCode='" & Trim(RecTemp.Fields("ItemCode")) & "'"
  819.                 
  820.                 .Open Sqlstr, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  821.                 
  822.                 If Not Rec_AccSumAssi.EOF Then
  823.                     .Fields("Mjje") = .Fields("Mjje") + RecTemp.Fields("Jfjehj")               '本月借方金额合计
  824.                     .Fields("Mdje") = .Fields("Mdje") + RecTemp.Fields("Dfjehj")               '本月贷方金额合计
  825.                     .Fields("Byjfljje") = .Fields("Byjfljje") + RecTemp.Fields("Jfjehj")       '本年借方金额累计
  826.                     .Fields("Bydfljje") = .Fields("Bydfljje") + RecTemp.Fields("Dfjehj")       '本月贷方金额累计
  827.                     .Fields("Qmye") = .Fields("Qcye") + .Fields("Mjje") - .Fields("Mdje")      '本月期末余额
  828.                     .Fields("Mjsl") = .Fields("Mjsl") + RecTemp.Fields("Jfslhj")               '本月借方数量合计
  829.                     .Fields("Mdsl") = .Fields("Mdsl") + RecTemp.Fields("Dfslhj")               '本月贷方数量合计
  830.                     .Fields("Byjfljsl") = .Fields("Byjfljsl") + RecTemp.Fields("Jfslhj")       '本年借方数量累计
  831.                     .Fields("Bydfljsl") = .Fields("Bydfljsl") + RecTemp.Fields("Dfslhj")       '本月贷方数量累计
  832.                     .Fields("Qmsl") = .Fields("Qcsl") + .Fields("Mjsl") - .Fields("Mdsl")      '本月数量余额
  833.                     .Fields("Mjwb") = .Fields("Mjwb") + RecTemp.Fields("Wbjfjehj")             '本月借方外币合计
  834.                     .Fields("Mdwb") = .Fields("Mdwb") + RecTemp.Fields("Wbdfjehj")             '本月贷方外币合计
  835.                     .Fields("Byjfljwb") = .Fields("Byjfljwb") + RecTemp.Fields("Wbjfjehj")     '本年借方外币累计
  836.                     .Fields("Bydfljwb") = .Fields("Bydfljwb") + RecTemp.Fields("Wbdfjehj")     '本月贷方外币累计
  837.                     .Fields("Qmwb") = .Fields("Qcwb") + .Fields("Mjwb") - .Fields("Mdwb")      '本月外币余额
  838.                     .Fields("ItemMjsl") = .Fields("ItemMjsl") + RecTemp.Fields("ItemJfslhj")          '本月借方项目数量合计
  839.                     .Fields("ItemMdsl") = .Fields("ItemMdsl") + RecTemp.Fields("ItemDfslhj")          '本月贷方项目数量合计
  840.                     .Fields("ItemByljjfsl") = .Fields("ItemByljjfsl") + RecTemp.Fields("ItemJfslhj")  '本年借方项目数量累计
  841.                     .Fields("ItemByljdfsl") = .Fields("ItemByljdfsl") + RecTemp.Fields("ItemDfslhj")  '本月贷方外币累计
  842.                     .Fields("QmItemsl") = .Fields("QcItemsl") + .Fields("ItemMjsl") - .Fields("ItemMdsl")  '本月项目数量余额
  843.                     Sqlstr = "Update Cwzz_AccSumAssi Set Qcye=" & .Fields("Qmye") & ",Byjfljje=" & .Fields("Byjfljje") & ",Bydfljje=" & .Fields("Bydfljje") & ",Qmye=" & .Fields("Qmye") & _
  844.                     ",Qcsl=" & .Fields("Qmsl") + 0 & ",Byjfljsl=" & .Fields("Byjfljsl") + 0 & ",Bydfljsl=" & .Fields("Bydfljsl") + 0 & ",Qmsl=" & .Fields("Qmsl") + 0 & _
  845.                     ",Qcwb=" & .Fields("Qmwb") + 0 & ",Byjfljwb=" & .Fields("Byjfljwb") + 0 & ",Bydfljwb=" & .Fields("Bydfljwb") + 0 & ",Qmwb=" & .Fields("Qmwb") + 0 & _
  846.                     ",QcItemsl=" & .Fields("QmItemsl") & ",ItemByljjfsl=" & .Fields("ItemByljjfsl") & ",ItemByLjdfsl=" & .Fields("ItemByLjdfsl") & ",QmItemsl=" & .Fields("QmItemsl") & _
  847.                     " Where Ccode='" & Trim(RecTemp.Fields("Ccode")) & "' And DeptCode='" & Trim(RecTemp.Fields("DeptCode") & "") & "' And PersonCode='" & Trim(RecTemp.Fields("PersonCode") & "") & "' And CusCode='" & Trim(RecTemp.Fields("CusCode") & "") & "'" & _
  848.                     " And SupplierCode='" & Trim(RecTemp.Fields("SupplierCode") & "") & "' And ItemClassCode='" & Trim(RecTemp.Fields("ItemClassCode") & "") & "' And ItemCode='" & Trim(RecTemp.Fields("ItemCode") & "") & "'" & _
  849.                     " And Year=" & Int_DqYear & " And Period > " & Int_DqPeriod
  850.                     
  851.                     Cw_DataEnvi.DataConnect.Execute (Sqlstr)
  852.                 Else
  853.                     .AddNew
  854.                     .Fields("Ccode") = Trim(RecTemp.Fields("Ccode"))                                            '科目编码
  855.                     .Fields("Year") = Int_DqYear                                             '会计年度
  856.                     .Fields("Period") = Int_DqPeriod                                         '会计期间
  857.                     .Fields("DeptCode") = Trim(RecTemp.Fields("DeptCode") & "")              '部门编码
  858.                     .Fields("CusCode") = Trim(RecTemp.Fields("CusCode") & "")                '客户编码
  859.                     .Fields("SupplierCode") = Trim(RecTemp.Fields("SupplierCode") & "")    '供应商编码
  860.                     .Fields("PersonCode") = Trim(RecTemp.Fields("PersonCode") & "")          '个人编码
  861.                     .Fields("ItemClassCode") = Trim(RecTemp.Fields("ItemClassCode") & "")    '项目分类编码
  862.                     .Fields("ItemCode") = Trim(RecTemp.Fields("ItemCode") & "")              '项目编码
  863.                     .Fields("Mjje") = RecTemp.Fields("Jfjehj")                                 '本月借方金额合计
  864.                     .Fields("Mdje") = RecTemp.Fields("Dfjehj")                                 '本月贷方金额合计
  865.                     .Fields("Byjfljje") = RecTemp.Fields("Jfjehj")                             '本年借方金额累计
  866.                     .Fields("Bydfljje") = RecTemp.Fields("Dfjehj")                             '本月贷方金额累计
  867.                     .Fields("Qmye") = .Fields("Mjje") - .Fields("Mdje")                        '本月期末余额
  868.                     .Fields("Mjsl") = RecTemp.Fields("Jfslhj") + 0                             '本月借方数量合计
  869.                     .Fields("Mdsl") = RecTemp.Fields("Dfslhj") + 0                             '本月贷方数量合计
  870.                     .Fields("Byjfljsl") = RecTemp.Fields("Jfslhj") + 0                         '本年借方数量累计
  871.                     .Fields("Bydfljsl") = RecTemp.Fields("Dfslhj") + 0                         '本年贷方数量累计
  872.                     .Fields("Qmsl") = .Fields("Mjsl") - .Fields("Mdsl")                        '本月数量余额
  873.                     .Fields("Mjwb") = RecTemp.Fields("Wbjfjehj")                               '本月借方外币合计
  874.                     .Fields("Mdwb") = RecTemp.Fields("Wbdfjehj")                               '本月贷方外币合计
  875.                     .Fields("Byjfljwb") = RecTemp.Fields("Wbjfjehj")                           '本年借方外币累计
  876.                     .Fields("Bydfljwb") = RecTemp.Fields("Wbdfjehj")                           '本年贷方外币累计
  877.                     .Fields("Qmwb") = .Fields("Mjwb") - .Fields("Mdwb")                        '本月外币余额
  878.                     .Fields("ItemMjsl") = RecTemp.Fields("ItemJfslhj") + 0                     '本月借方项目数量合计
  879.                     .Fields("ItemMdsl") = RecTemp.Fields("ItemDfslhj") + 0                     '本月贷方项目数量合计
  880.                     .Fields("ItemByljjfsl") = RecTemp.Fields("ItemJfslhj") + 0                 '本年借方项目数量累计
  881.                     .Fields("ItemByljdfsl") = RecTemp.Fields("ItemDfslhj") + 0                 '本月贷方项目数量累计
  882.                     .Fields("QmItemsl") = .Fields("ItemMjsl") - .Fields("ItemMdsl")          '本月项目数量余额
  883.                     
  884.                     '添加并更新其他会计期间数据(按12个会计期间)
  885.                     For Int_PeriodTe = 1 To 12
  886.                         If Int_PeriodTe <> Int_DqPeriod Then
  887.                             Sqlstr = "Insert Into Cwzz_AccSumAssi (Ccode,Year,Period,DeptCode,PersonCode,CusCode,SupplierCode,ItemClassCode,ItemCode) values ('" & Trim(RecTemp.Fields("Ccode")) & "'," & _
  888.                             Int_DqYear & "," & Int_PeriodTe & ",'" & Trim(RecTemp.Fields("DeptCode")) & "','" & Trim(RecTemp.Fields("PersonCode")) & "','" & Trim(RecTemp.Fields("CusCode")) & "','" & Trim(RecTemp.Fields("SupplierCode")) & "','" & Trim(RecTemp.Fields("ItemClassCode")) & "','" & Trim(RecTemp.Fields("ItemCode")) & "')"
  889.                             Cw_DataEnvi.DataConnect.Execute (Sqlstr)
  890.                         End If
  891.                     Next Int_PeriodTe
  892.                     
  893.                     Sqlstr = "Update Cwzz_AccSumAssi Set Qcye=" & .Fields("Qmye") & ",Byjfljje=" & .Fields("Byjfljje") & ",Bydfljje=" & .Fields("Bydfljje") & ",Qmye=" & .Fields("Qmye") & _
  894.                     ",Qcsl=" & .Fields("Qmsl") + 0 & ",Byjfljsl=" & .Fields("Byjfljsl") + 0 & ",Bydfljsl=" & .Fields("Bydfljsl") + 0 & ",Qmsl=" & .Fields("Qmsl") + 0 & _
  895.                     ",Qcwb=" & .Fields("Qmwb") + 0 & ",Byjfljwb=" & .Fields("Byjfljwb") + 0 & ",Bydfljwb=" & .Fields("Bydfljwb") + 0 & ",Qmwb=" & .Fields("Qmwb") + 0 & _
  896.                     ",QcItemsl=" & .Fields("QmItemsl") & ",ItemByljjfsl=" & .Fields("ItemByljjfsl") & ",ItemByLjdfsl=" & .Fields("ItemByLjdfsl") & ",QmItemsl=" & .Fields("QmItemsl") & _
  897.                     " Where Ccode='" & Trim(RecTemp.Fields("Ccode")) & "' And DeptCode='" & Trim(RecTemp.Fields("DeptCode") & "") & "' And PersonCode='" & Trim(RecTemp.Fields("PersonCode") & "") & "' And CusCode='" & Trim(RecTemp.Fields("CusCode") & "") & "'" & _
  898.                     " And SupplierCode='" & Trim(RecTemp.Fields("SupplierCode") & "") & "' And ItemClassCode='" & Trim(RecTemp.Fields("ItemClassCode") & "") & "' And ItemCode='" & Trim(RecTemp.Fields("ItemCode") & "") & "'" & _
  899.                     " And Year=" & Int_DqYear & " And Period > " & Int_DqPeriod
  900.                     
  901.                     Cw_DataEnvi.DataConnect.Execute (Sqlstr)
  902.                     
  903.                 End If
  904.                 
  905.                 .Update
  906.                 
  907.             End If
  908.             
  909.         End With  'Rec_AccSumAssi
  910.         
  911.         '指针移动到下一条记录
  912.         RecTemp.MoveNext
  913.         
  914.         Prg_Book.Value = Prg_Book.Value + 1
  915.         
  916.     Loop
  917.     
  918.     '记帐凭证明细记录写记帐标识
  919.     Sqlstr = "Update Cwzz_AccVouchMain Set BookFlag=1,Book='" & Xtczy & "' WHERE  Year = " & Int_DqYear & " And Period = " & Int_DqPeriod & " And checkflag = 1 And bookflag = 0 "
  920.     Cw_DataEnvi.DataConnect.Execute (Sqlstr)
  921.     
  922.     Cw_DataEnvi.DataConnect.CommitTrans
  923.     
  924.     '隐藏进度显示
  925.     Fra_Book.Visible = False
  926.     
  927.     Tsxx = "记 帐 完 毕!"
  928.     Call Xtxxts(Tsxx, 0, 4)
  929.     
  930.     Unload Me
  931.     
  932.     Exit Sub
  933.     
  934. Swcwcl:
  935.     Fra_Book.Visible = False
  936.     Cw_DataEnvi.DataConnect.RollbackTrans
  937.     Tsxx = "记帐过程中出现未知错误,程序自动恢复记帐前状态!"
  938.     Call Xtxxts(Tsxx, 0, 1)
  939.     Exit Sub
  940. End Sub
  941. Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
  942.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  943.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  944.     Bbxbtgs = 1                                          '报 表 小 标 题 行 数
  945.     Bbbwhgs = 0                                          '报 表 表 尾 行 数
  946.     ReDim Bbxbt(1 To Bbxbtgs)
  947.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  948.     If Bbbwhgs <> 0 Then
  949.         ReDim Bbbwh(1 To Bbbwhgs)
  950.         ReDim Bbbwhzzxs(1 To Bbbwhgs)
  951.     End If
  952.     Bbzbt = ReportTitle
  953.     Bbxbt(1) = " "
  954.     bbxbtzzxs(1) = 0                                     '报表行组织形式(0-居左 1-居中 2-居右)
  955.     Call Scyxsjb(CxbbGrid)                               '生成报表数据
  956.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  957.     If Not bbylte Then
  958.         Unload DY_Tybbyldy
  959.     End If
  960. End Sub
  961. '判断是否起初录入完成
  962. Function FinishInit() As Boolean
  963.     Dim str_Sql As String                        '查询字符串
  964.     Dim rs As New ADODB.Recordset                '临时使用动态集
  965.     
  966.     str_Sql = "select isnull(ItemValue,0) from Gy_AccInformation where SystemCode='Cwzz' and ItemCode='Cwzz_Qclrwc'"
  967.     Set rs = Cw_DataEnvi.DataConnect.Execute(str_Sql)
  968.     If rs.EOF Then Exit Function
  969.     
  970.     If CInt(rs(0)) = 1 Then
  971.         FinishInit = True
  972.     Else
  973.         FinishInit = False
  974.     End If
  975. End Function