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

企业管理

开发平台:

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 YS_FrmDeptBudget 
  5.    BackColor       =   &H00C0C0C0&
  6.    BorderStyle     =   1  'Fixed Single
  7.    Caption         =   "部门预算表"
  8.    ClientHeight    =   7965
  9.    ClientLeft      =   675
  10.    ClientTop       =   720
  11.    ClientWidth     =   11400
  12.    BeginProperty Font 
  13.       Name            =   "宋体"
  14.       Size            =   14.25
  15.       Charset         =   0
  16.       Weight          =   700
  17.       Underline       =   0   'False
  18.       Italic          =   0   'False
  19.       Strikethrough   =   0   'False
  20.    EndProperty
  21.    HelpContextID   =   411004001
  22.    Icon            =   "预算设置_部门预算.frx":0000
  23.    KeyPreview      =   -1  'True
  24.    LinkTopic       =   "Form4"
  25.    MaxButton       =   0   'False
  26.    MinButton       =   0   'False
  27.    ScaleHeight     =   7965
  28.    ScaleWidth      =   11400
  29.    StartUpPosition =   1  '所有者中心
  30.    Begin VB.CommandButton Ydcommand 
  31.       BeginProperty Font 
  32.          Name            =   "MS Sans Serif"
  33.          Size            =   8.25
  34.          Charset         =   0
  35.          Weight          =   400
  36.          Underline       =   0   'False
  37.          Italic          =   0   'False
  38.          Strikethrough   =   0   'False
  39.       EndProperty
  40.       Height          =   300
  41.       Left            =   9030
  42.       Picture         =   "预算设置_部门预算.frx":1042
  43.       Style           =   1  'Graphical
  44.       TabIndex        =   1
  45.       Top             =   3660
  46.       Visible         =   0   'False
  47.       Width           =   300
  48.    End
  49.    Begin VB.PictureBox Pic_Title 
  50.       BeginProperty Font 
  51.          Name            =   "MS Sans Serif"
  52.          Size            =   8.25
  53.          Charset         =   0
  54.          Weight          =   400
  55.          Underline       =   0   'False
  56.          Italic          =   0   'False
  57.          Strikethrough   =   0   'False
  58.       EndProperty
  59.       Height          =   1125
  60.       Left            =   0
  61.       Picture         =   "预算设置_部门预算.frx":13CC
  62.       ScaleHeight     =   1065
  63.       ScaleWidth      =   11715
  64.       TabIndex        =   7
  65.       Top             =   570
  66.       Width           =   11775
  67.       Begin MSComctlLib.ImageList ImageList1 
  68.          Left            =   4260
  69.          Top             =   60
  70.          _ExtentX        =   1005
  71.          _ExtentY        =   1005
  72.          BackColor       =   -2147483643
  73.          ImageWidth      =   16
  74.          ImageHeight     =   16
  75.          MaskColor       =   12632256
  76.          _Version        =   393216
  77.          BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  78.             NumListImages   =   25
  79.             BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  80.                Picture         =   "预算设置_部门预算.frx":35490
  81.                Key             =   "sz"
  82.             EndProperty
  83.             BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  84.                Picture         =   "预算设置_部门预算.frx":3582A
  85.                Key             =   "dy"
  86.             EndProperty
  87.             BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  88.                Picture         =   "预算设置_部门预算.frx":35BC4
  89.                Key             =   "yl"
  90.             EndProperty
  91.             BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  92.                Picture         =   "预算设置_部门预算.frx":35F5E
  93.                Key             =   "xg"
  94.             EndProperty
  95.             BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  96.                Picture         =   "预算设置_部门预算.frx":362F8
  97.                Key             =   "zh"
  98.             EndProperty
  99.             BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  100.                Picture         =   "预算设置_部门预算.frx":36692
  101.                Key             =   "sh"
  102.             EndProperty
  103.             BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  104.                Picture         =   "预算设置_部门预算.frx":36A2C
  105.                Key             =   "bc"
  106.             EndProperty
  107.             BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  108.                Picture         =   "预算设置_部门预算.frx":36DC6
  109.                Key             =   "fq"
  110.             EndProperty
  111.             BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  112.                Picture         =   "预算设置_部门预算.frx":37160
  113.                Key             =   "bz"
  114.             EndProperty
  115.             BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  116.                Picture         =   "预算设置_部门预算.frx":374FA
  117.                Key             =   "tc"
  118.             EndProperty
  119.             BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  120.                Picture         =   "预算设置_部门预算.frx":37894
  121.                Key             =   "bcgs"
  122.             EndProperty
  123.             BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  124.                Picture         =   "预算设置_部门预算.frx":37C2E
  125.                Key             =   "mrlk"
  126.             EndProperty
  127.             BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  128.                Picture         =   "预算设置_部门预算.frx":37FC8
  129.                Key             =   "xsxm"
  130.             EndProperty
  131.             BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  132.                Picture         =   "预算设置_部门预算.frx":38362
  133.                Key             =   "first"
  134.             EndProperty
  135.             BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  136.                Picture         =   "预算设置_部门预算.frx":386FC
  137.                Key             =   "prev"
  138.             EndProperty
  139.             BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  140.                Picture         =   "预算设置_部门预算.frx":38A96
  141.                Key             =   "next"
  142.             EndProperty
  143.             BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  144.                Picture         =   "预算设置_部门预算.frx":38E30
  145.                Key             =   "last"
  146.             EndProperty
  147.             BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  148.                Picture         =   "预算设置_部门预算.frx":391CA
  149.                Key             =   "xx"
  150.             EndProperty
  151.             BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  152.                Picture         =   "预算设置_部门预算.frx":39564
  153.                Key             =   "define"
  154.             EndProperty
  155.             BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  156.                Picture         =   "预算设置_部门预算.frx":398FE
  157.                Key             =   "exec"
  158.             EndProperty
  159.             BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  160.                Picture         =   "预算设置_部门预算.frx":39C98
  161.                Key             =   "xz"
  162.             EndProperty
  163.             BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  164.                Picture         =   "预算设置_部门预算.frx":3A032
  165.                Key             =   "sc"
  166.             EndProperty
  167.             BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  168.                Picture         =   "预算设置_部门预算.frx":3A3CC
  169.                Key             =   "sx"
  170.             EndProperty
  171.             BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  172.                Picture         =   "预算设置_部门预算.frx":3A766
  173.                Key             =   "cx"
  174.             EndProperty
  175.             BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  176.                Picture         =   "预算设置_部门预算.frx":3AB00
  177.                Key             =   "zd"
  178.             EndProperty
  179.          EndProperty
  180.       End
  181.       Begin VB.Label Label1 
  182.          Appearance      =   0  'Flat
  183.          BackColor       =   &H80000005&
  184.          BackStyle       =   0  'Transparent
  185.          Caption         =   "部门名称:"
  186.          BeginProperty Font 
  187.             Name            =   "MS Sans Serif"
  188.             Size            =   8.25
  189.             Charset         =   0
  190.             Weight          =   400
  191.             Underline       =   0   'False
  192.             Italic          =   0   'False
  193.             Strikethrough   =   0   'False
  194.          EndProperty
  195.          ForeColor       =   &H80000008&
  196.          Height          =   195
  197.          Index           =   0
  198.          Left            =   750
  199.          TabIndex        =   12
  200.          Top             =   810
  201.          Width           =   795
  202.       End
  203.       Begin VB.Label lbl_AccountYear 
  204.          BackStyle       =   0  'Transparent
  205.          BeginProperty Font 
  206.             Name            =   "MS Sans Serif"
  207.             Size            =   8.25
  208.             Charset         =   0
  209.             Weight          =   400
  210.             Underline       =   0   'False
  211.             Italic          =   0   'False
  212.             Strikethrough   =   0   'False
  213.          EndProperty
  214.          ForeColor       =   &H00FF0000&
  215.          Height          =   285
  216.          Left            =   5400
  217.          TabIndex        =   11
  218.          Top             =   780
  219.          Width           =   795
  220.       End
  221.       Begin VB.Label Label1 
  222.          Appearance      =   0  'Flat
  223.          BackColor       =   &H80000005&
  224.          BackStyle       =   0  'Transparent
  225.          Caption         =   "会计年度:"
  226.          BeginProperty Font 
  227.             Name            =   "MS Sans Serif"
  228.             Size            =   8.25
  229.             Charset         =   0
  230.             Weight          =   400
  231.             Underline       =   0   'False
  232.             Italic          =   0   'False
  233.             Strikethrough   =   0   'False
  234.          EndProperty
  235.          ForeColor       =   &H80000008&
  236.          Height          =   195
  237.          Index           =   2
  238.          Left            =   4320
  239.          TabIndex        =   10
  240.          Top             =   780
  241.          Width           =   795
  242.       End
  243.       Begin VB.Label Lbl_Dept 
  244.          BackStyle       =   0  'Transparent
  245.          BeginProperty Font 
  246.             Name            =   "MS Sans Serif"
  247.             Size            =   8.25
  248.             Charset         =   0
  249.             Weight          =   400
  250.             Underline       =   0   'False
  251.             Italic          =   0   'False
  252.             Strikethrough   =   0   'False
  253.          EndProperty
  254.          ForeColor       =   &H00FF0000&
  255.          Height          =   285
  256.          Left            =   1740
  257.          TabIndex        =   9
  258.          Top             =   780
  259.          Width           =   2325
  260.       End
  261.       Begin VB.Label tsLabel 
  262.          BackColor       =   &H80000018&
  263.          BackStyle       =   0  'Transparent
  264.          Caption         =   "部门预算表"
  265.          BeginProperty Font 
  266.             Name            =   "宋体"
  267.             Size            =   12
  268.             Charset         =   134
  269.             Weight          =   700
  270.             Underline       =   0   'False
  271.             Italic          =   0   'False
  272.             Strikethrough   =   0   'False
  273.          EndProperty
  274.          ForeColor       =   &H00000000&
  275.          Height          =   285
  276.          Index           =   4
  277.          Left            =   570
  278.          TabIndex        =   8
  279.          Top             =   210
  280.          Width           =   2655
  281.       End
  282.    End
  283.    Begin VB.TextBox Ydtext 
  284.       BackColor       =   &H00C0FFFF&
  285.       BorderStyle     =   0  'None
  286.       BeginProperty Font 
  287.          Name            =   "MS Sans Serif"
  288.          Size            =   8.25
  289.          Charset         =   0
  290.          Weight          =   400
  291.          Underline       =   0   'False
  292.          Italic          =   0   'False
  293.          Strikethrough   =   0   'False
  294.       EndProperty
  295.       Height          =   330
  296.       Left            =   8310
  297.       MultiLine       =   -1  'True
  298.       TabIndex        =   0
  299.       Top             =   3690
  300.       Visible         =   0   'False
  301.       Width           =   1185
  302.    End
  303.    Begin VB.ComboBox YdCombo 
  304.       BeginProperty Font 
  305.          Name            =   "MS Sans Serif"
  306.          Size            =   8.25
  307.          Charset         =   0
  308.          Weight          =   400
  309.          Underline       =   0   'False
  310.          Italic          =   0   'False
  311.          Strikethrough   =   0   'False
  312.       EndProperty
  313.       Height          =   300
  314.       Left            =   8310
  315.       Style           =   2  'Dropdown List
  316.       TabIndex        =   3
  317.       Top             =   4110
  318.       Visible         =   0   'False
  319.       Width           =   1155
  320.    End
  321.    Begin VB.Timer Timer1 
  322.       Interval        =   1
  323.       Left            =   8310
  324.       Top             =   2970
  325.    End
  326.    Begin VSFlex8Ctl.VSFlexGrid WglrGrid 
  327.       Height          =   6225
  328.       Left            =   0
  329.       TabIndex        =   4
  330.       Top             =   1710
  331.       Width           =   11775
  332.       _cx             =   5080
  333.       _cy             =   5080
  334.       Appearance      =   1
  335.       BorderStyle     =   1
  336.       Enabled         =   -1  'True
  337.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  338.          Name            =   "宋体"
  339.          Size            =   9
  340.          Charset         =   134
  341.          Weight          =   400
  342.          Underline       =   0   'False
  343.          Italic          =   0   'False
  344.          Strikethrough   =   0   'False
  345.       EndProperty
  346.       MousePointer    =   0
  347.       BackColor       =   16777215
  348.       ForeColor       =   -2147483640
  349.       BackColorFixed  =   12632256
  350.       ForeColorFixed  =   -2147483630
  351.       BackColorSel    =   -2147483635
  352.       ForeColorSel    =   -2147483634
  353.       BackColorBkg    =   -2147483636
  354.       BackColorAlternate=   16777215
  355.       GridColor       =   -2147483633
  356.       GridColorFixed  =   -2147483632
  357.       TreeColor       =   -2147483632
  358.       FloodColor      =   192
  359.       SheetBorder     =   -2147483642
  360.       FocusRect       =   1
  361.       HighLight       =   1
  362.       AllowSelection  =   -1  'True
  363.       AllowBigSelection=   -1  'True
  364.       AllowUserResizing=   0
  365.       SelectionMode   =   0
  366.       GridLines       =   1
  367.       GridLinesFixed  =   2
  368.       GridLineWidth   =   1
  369.       Rows            =   50
  370.       Cols            =   10
  371.       FixedRows       =   1
  372.       FixedCols       =   1
  373.       RowHeightMin    =   0
  374.       RowHeightMax    =   0
  375.       ColWidthMin     =   0
  376.       ColWidthMax     =   0
  377.       ExtendLastCol   =   0   'False
  378.       FormatString    =   ""
  379.       ScrollTrack     =   0   'False
  380.       ScrollBars      =   3
  381.       ScrollTips      =   0   'False
  382.       MergeCells      =   0
  383.       MergeCompare    =   0
  384.       AutoResize      =   -1  'True
  385.       AutoSizeMode    =   0
  386.       AutoSearch      =   0
  387.       AutoSearchDelay =   2
  388.       MultiTotals     =   -1  'True
  389.       SubtotalPosition=   1
  390.       OutlineBar      =   0
  391.       OutlineCol      =   0
  392.       Ellipsis        =   0
  393.       ExplorerBar     =   0
  394.       PicturesOver    =   0   'False
  395.       FillStyle       =   0
  396.       RightToLeft     =   0   'False
  397.       PictureType     =   0
  398.       TabBehavior     =   0
  399.       OwnerDraw       =   0
  400.       Editable        =   0
  401.       ShowComboButton =   1
  402.       WordWrap        =   0   'False
  403.       TextStyle       =   0
  404.       TextStyleFixed  =   0
  405.       OleDragMode     =   0
  406.       OleDropMode     =   0
  407.       DataMode        =   0
  408.       VirtualData     =   -1  'True
  409.       DataMember      =   ""
  410.       ComboSearch     =   3
  411.       AutoSizeMouse   =   -1  'True
  412.       FrozenRows      =   0
  413.       FrozenCols      =   0
  414.       AllowUserFreezing=   0
  415.       BackColorFrozen =   0
  416.       ForeColorFrozen =   0
  417.       WallPaperAlignment=   9
  418.       AccessibleName  =   ""
  419.       AccessibleDescription=   ""
  420.       AccessibleValue =   ""
  421.       AccessibleRole  =   24
  422.    End
  423.    Begin MSComctlLib.Toolbar Tlb_Action 
  424.       Align           =   1  'Align Top
  425.       Height          =   555
  426.       Left            =   0
  427.       TabIndex        =   2
  428.       Top             =   0
  429.       Width           =   11400
  430.       _ExtentX        =   20108
  431.       _ExtentY        =   979
  432.       ButtonWidth     =   820
  433.       ButtonHeight    =   926
  434.       AllowCustomize  =   0   'False
  435.       Wrappable       =   0   'False
  436.       Appearance      =   1
  437.       Style           =   1
  438.       ImageList       =   "ImageList1"
  439.       _Version        =   393216
  440.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  441.          NumButtons      =   10
  442.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  443.             Caption         =   "设置"
  444.             Key             =   "ymsz"
  445.             Object.ToolTipText     =   "打印页面设置"
  446.             ImageKey        =   "sz"
  447.          EndProperty
  448.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  449.             Caption         =   "打印"
  450.             Key             =   "dy"
  451.             Object.ToolTipText     =   "打印当前单据或Ctrl+P"
  452.             ImageKey        =   "dy"
  453.          EndProperty
  454.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  455.             Caption         =   "预览"
  456.             Key             =   "yl"
  457.             ImageKey        =   "yl"
  458.          EndProperty
  459.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  460.             Style           =   3
  461.          EndProperty
  462.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  463.             Caption         =   "删行"
  464.             Key             =   "sh"
  465.             Object.ToolTipText     =   "删除当前记录行或Delete"
  466.             ImageKey        =   "sh"
  467.          EndProperty
  468.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  469.             Style           =   3
  470.          EndProperty
  471.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  472.             Caption         =   "导入"
  473.             Key             =   "dr"
  474.             Description     =   "导入上年数据"
  475.             Object.ToolTipText     =   "导入上年数据"
  476.             ImageKey        =   "zd"
  477.          EndProperty
  478.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  479.             Style           =   3
  480.          EndProperty
  481.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  482.             Caption         =   "帮助"
  483.             Key             =   "bz"
  484.             ImageKey        =   "bz"
  485.          EndProperty
  486.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  487.             Caption         =   "退出"
  488.             Key             =   "fh"
  489.             ImageKey        =   "tc"
  490.          EndProperty
  491.       EndProperty
  492.       BorderStyle     =   1
  493.       Begin MSComctlLib.Toolbar GsToolbar 
  494.          Height          =   525
  495.          Left            =   9720
  496.          TabIndex        =   6
  497.          Top             =   0
  498.          Width           =   1695
  499.          _ExtentX        =   2990
  500.          _ExtentY        =   926
  501.          ButtonWidth     =   1455
  502.          ButtonHeight    =   926
  503.          AllowCustomize  =   0   'False
  504.          Appearance      =   1
  505.          Style           =   1
  506.          ImageList       =   "ImageList1"
  507.          _Version        =   393216
  508.          BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  509.             NumButtons      =   2
  510.             BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  511.                Caption         =   "保存格式"
  512.                Key             =   "bcgs"
  513.                ImageKey        =   "bcgs"
  514.             EndProperty
  515.             BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  516.                Caption         =   "默认列宽"
  517.                Key             =   "hfmrgs"
  518.                ImageKey        =   "mrlk"
  519.             EndProperty
  520.          EndProperty
  521.       End
  522.    End
  523.    Begin VB.Label Lab_OperStatus 
  524.       BackColor       =   &H000080FF&
  525.       Caption         =   "1"
  526.       BeginProperty Font 
  527.          Name            =   "MS Sans Serif"
  528.          Size            =   8.25
  529.          Charset         =   0
  530.          Weight          =   400
  531.          Underline       =   0   'False
  532.          Italic          =   0   'False
  533.          Strikethrough   =   0   'False
  534.       EndProperty
  535.       Height          =   345
  536.       Left            =   10980
  537.       TabIndex        =   5
  538.       Top             =   1230
  539.       Visible         =   0   'False
  540.       Width           =   345
  541.    End
  542. End
  543. Attribute VB_Name = "YS_FrmDeptBudget"
  544. Attribute VB_GlobalNameSpace = False
  545. Attribute VB_Creatable = False
  546. Attribute VB_PredeclaredId = True
  547. Attribute VB_Exposed = False
  548. '**************************************************************************************************
  549. '*    模 块 名 称 :部门预算表
  550. '*    功 能 描 述 :对所进行预算的会计科目的预算金额录入
  551. '*    程序员姓名  :魏永生
  552. '*    最后修改人  :
  553. '*    最后修改时间:2002/01/21
  554. '*    备        注:程序中所有依实际情况自定义部分均用[>> <<]括起
  555. '*
  556. '*    1.每次调入外部功能窗体,均要加锁ChangeLock=True,窗体关闭后解锁ChangeLock=false
  557. '*    2.网格列存储内容注解
  558. '*      0-行有效标识 1-记录编辑唯一标识 2-科目编码
  559. '*    3.Lab_OperStatus 用此标签来标识单据录入状态(默认值为1) 1-浏览 2-修改
  560. '**************************************************************************************************
  561.     
  562.  '以下为固定使用变量(网格)
  563. Dim Cxnrrec As New ADODB.Recordset              '显示查询内容动态集
  564. Dim Dyymctbl As New DY_Dyymsz                   '打印页面窗体变量
  565. Dim GridCode As String                          '显示网格网格代码
  566. Dim GridInf() As Variant                        '整个网格设置信息
  567. Dim ReportTitle As String                       '报表主标题
  568. Dim Tsxx As String                              '系统提示信息
  569. Dim Pmbcsjhs As Long                            '屏幕网格保持数据行数(大于等于1)
  570. Dim Fzxwghs As Integer                          '辅助项网格行数(包括合计行)
  571. Dim Sfxshjwg As Boolean                         '是否显示合计网格
  572. Dim Qslz As Long                                '网格隐藏(非操作显示)列数
  573. Dim Sjhgd As Double                             '网格数据行高度
  574. Dim GridBoolean() As Boolean                    '网格列信息(布尔型)
  575. Dim GridStr()  As String                        '网格列信息(字符型)
  576. Dim GridInt() As Integer                        '网格列信息(整型)
  577. Dim Sfblbzkd As Boolean                         '是否保留帮助宽度(字段提供帮助时,是否为按钮保留空间)
  578. Dim Dqlrwgh As Long                             '当前录入数据网格行
  579. Dim Dqlrwgl As Long                             '当前录入数据网格列
  580. Dim Dqlkwgh As Long                             '刚刚离开网格行(不一定为录入行)
  581. Dim Dqlkwgl As Long                             '刚刚离开网格列
  582. Dim Dqtoprow As Long                            '当前录入状态时最上端可视行
  583. Dim Dqleftcol As Long                           '当前录入状态时最左端可视列
  584. Dim Zdlrqnr As String                           '字段录入修改前内容(用来判断内容是否修改)
  585. Dim Wbkbhlock As Boolean                        '文本框改变值锁
  586. Dim changelock As Boolean                       '网格行列改变控制锁(用来区别用户改变.程序改变)
  587. Dim Gdtlock As Boolean                          '滚动条滚动控制(用来区别用户改变.程序改变)
  588. Dim Yxxpdlock As Boolean                        '字段有效性判断锁(内容不修改不需进行字段有效性判断)
  589. Dim Hyxxpdlock As Boolean                       '行有效性判断锁(字段内容不修改不需进行行有效性判断)
  590. Dim Valilock As Boolean                         '文本框失去焦点是否进行有效性控制(TRUE 为锁定*限用网格录入)
  591. Dim Shsfts As Boolean                           '删除记录行是否提示
  592. Dim Szzls As Integer                            '网格信息数组最大下标值(网格列数-1)
  593. Private Sub Form_KeyPress(KeyAscii As Integer)      '控制焦点转移和限制录入字符"'"
  594.     Select Case KeyAscii
  595.     Case 39           '屏蔽字符"'"
  596.         KeyAscii = 0
  597.     End Select
  598. End Sub
  599. Private Sub Form_Load()                              '窗 体 装 入
  600.     Dim RecTemp As New ADODB.Recordset              '临时使用动态集
  601.     '隐藏选择对话框
  602.     lbl_AccountYear.Caption = Str(Int_OriYear)
  603.     Lbl_Dept = Trim(Str_DeptName)
  604.     
  605.     YS_FrmDeptBudgetC.Hide
  606.     
  607.     
  608.     '初始化各种锁值
  609.     changelock = False             '网格行列改变控制锁
  610.     Gdtlock = False                '滚动条滚动控制
  611.     Yxxpdlock = True               '字段有效性判断锁
  612.     Hyxxpdlock = True              '行有效性判断锁
  613.     Wbkbhlock = False              '文本框内容改变锁
  614.     
  615.     '报表主标题及报表编码
  616.     ReportTitle = "部门预算表"
  617.     XtReportCode = "cwfx_Budget"
  618.     Load Dyymctbl
  619.     
  620.     '调 入 网 格
  621.     GridCode = "cwfx_DeptBudget"      '网格属性编码
  622.     Call BzWgcsh(WglrGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  623.     
  624.     Qslz = GridInf(1)
  625.     Sjhgd = GridInf(2)
  626.     Pmbcsjhs = GridInf(3)
  627.     Fzxwghs = GridInf(4)
  628.     Sfblbzkd = GridInf(5)
  629.     Shsfts = GridInf(6)
  630.     Sfxshjwg = GridInf(7)
  631.     Szzls = WglrGrid.Cols - 1
  632.     
  633.     '生成查询结果
  634.     Call Sub_Query
  635.     
  636.     '设置状态为修改状态
  637.     Lab_OperStatus = "2"
  638.     
  639. End Sub
  640. Private Sub Form_Unload(Cancel As Integer)           '窗体卸载
  641.     
  642.     '卸载打印页面窗体
  643.     Unload Dyymctbl
  644.     Unload YS_FrmDeptBudgetC
  645.     
  646. End Sub
  647. Private Sub Sub_Query()                              '生成查询结果
  648.     Dim SqlStr As String                   '查询字符串
  649.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  650.     Dim Jsqte  As Long                     '临时计数器
  651.     Dim Cur_SumBudget As Currency
  652.     
  653.     SqlStr = "SELECT Cwfx_DeptBudgetMaster.*,CName FROM Cwfx_DeptBudgetMaster,Cwzz_AccCode "
  654.     SqlStr = SqlStr + " where Cwfx_DeptBudgetMaster.CCode=Cwzz_AccCode.CCode And Year=" & Str(Int_OriYear) & " and DeptCode='" & Str_DeptCode & "'"
  655.     SqlStr = SqlStr + " order by Cwfx_DeptBudgetMaster.Ccode "
  656.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  657.     
  658.     With RecTemp
  659.         
  660.         WglrGrid.Clear 1
  661.         
  662.         WglrGrid.Rows = .RecordCount + WglrGrid.FixedRows
  663.         
  664.         Jsqte = WglrGrid.FixedRows
  665.         Do While Not .EOF
  666.             If Jsqte >= WglrGrid.Rows Then
  667.                 WglrGrid.AddItem ""
  668.             End If
  669.             
  670.             WglrGrid.TextMatrix(Jsqte, 0) = "*"                                                              '有效记录标识
  671.             WglrGrid.TextMatrix(Jsqte, 1) = Trim(.Fields("I_id"))            '记录唯一标识
  672.             WglrGrid.TextMatrix(Jsqte, 2) = Trim(.Fields("CCode"))
  673.             
  674.             
  675.             WglrGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("Cname"))
  676.             WglrGrid.TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = IIf(.Fields("Budget_1") = 0, "", .Fields("budget_1"))
  677.             WglrGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = IIf(.Fields("Add_1") = 0, "", .Fields("Add_1"))
  678.             WglrGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = IIf(.Fields("Budget_2") = 0, "", .Fields("budget_2"))
  679.             WglrGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = IIf(.Fields("Add_2") = 0, "", .Fields("Add_2"))
  680.             WglrGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = IIf(.Fields("Budget_3") = 0, "", .Fields("budget_3"))
  681.             WglrGrid.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = IIf(.Fields("Add_3") = 0, "", .Fields("Add_3"))
  682.             WglrGrid.TextMatrix(Jsqte, Sydz("008", GridStr(), Szzls)) = IIf(.Fields("Budget_4") = 0, "", .Fields("budget_4"))
  683.             WglrGrid.TextMatrix(Jsqte, Sydz("009", GridStr(), Szzls)) = IIf(.Fields("Add_4") = 0, "", .Fields("Add_4"))
  684.             WglrGrid.TextMatrix(Jsqte, Sydz("010", GridStr(), Szzls)) = IIf(.Fields("Budget_5") = 0, "", .Fields("budget_5"))
  685.             WglrGrid.TextMatrix(Jsqte, Sydz("011", GridStr(), Szzls)) = IIf(.Fields("Add_5") = 0, "", .Fields("Add_5"))
  686.             WglrGrid.TextMatrix(Jsqte, Sydz("012", GridStr(), Szzls)) = IIf(.Fields("Budget_6") = 0, "", .Fields("budget_6"))
  687.             WglrGrid.TextMatrix(Jsqte, Sydz("013", GridStr(), Szzls)) = IIf(.Fields("Add_6") = 0, "", .Fields("Add_6"))
  688.             WglrGrid.TextMatrix(Jsqte, Sydz("014", GridStr(), Szzls)) = IIf(.Fields("Budget_7") = 0, "", .Fields("budget_7"))
  689.             WglrGrid.TextMatrix(Jsqte, Sydz("015", GridStr(), Szzls)) = IIf(.Fields("Add_7") = 0, "", .Fields("Add_7"))
  690.             WglrGrid.TextMatrix(Jsqte, Sydz("016", GridStr(), Szzls)) = IIf(.Fields("Budget_8") = 0, "", .Fields("budget_8"))
  691.             WglrGrid.TextMatrix(Jsqte, Sydz("017", GridStr(), Szzls)) = IIf(.Fields("Add_8") = 0, "", .Fields("Add_8"))
  692.             WglrGrid.TextMatrix(Jsqte, Sydz("018", GridStr(), Szzls)) = IIf(.Fields("Budget_9") = 0, "", .Fields("budget_9"))
  693.             WglrGrid.TextMatrix(Jsqte, Sydz("019", GridStr(), Szzls)) = IIf(.Fields("Add_9") = 0, "", .Fields("Add_9"))
  694.             WglrGrid.TextMatrix(Jsqte, Sydz("020", GridStr(), Szzls)) = IIf(.Fields("Budget_10") = 0, "", .Fields("budget_10"))
  695.             WglrGrid.TextMatrix(Jsqte, Sydz("021", GridStr(), Szzls)) = IIf(.Fields("Add_10") = 0, "", .Fields("Add_10"))
  696.             WglrGrid.TextMatrix(Jsqte, Sydz("022", GridStr(), Szzls)) = IIf(.Fields("Budget_11") = 0, "", .Fields("budget_11"))
  697.             WglrGrid.TextMatrix(Jsqte, Sydz("023", GridStr(), Szzls)) = IIf(.Fields("Add_11") = 0, "", .Fields("Add_11"))
  698.             WglrGrid.TextMatrix(Jsqte, Sydz("024", GridStr(), Szzls)) = IIf(.Fields("Budget_12") = 0, "", .Fields("budget_12"))
  699.             WglrGrid.TextMatrix(Jsqte, Sydz("025", GridStr(), Szzls)) = IIf(.Fields("Add_12") = 0, "", .Fields("Add_12"))
  700.             
  701.             Cur_SumBudget = .Fields("Budget_1") + .Fields("Budget_2") + .Fields("Budget_3") + .Fields("Budget_4") + _
  702.             .Fields("Budget_5") + .Fields("Budget_6") + .Fields("Budget_7") + .Fields("Budget_8") + _
  703.             .Fields("Budget_9") + .Fields("Budget_10") + .Fields("Budget_11") + .Fields("Budget_12") + _
  704.             .Fields("Add_1") + .Fields("Add_2") + .Fields("Add_3") + .Fields("Add_4") + .Fields("Add_5") + _
  705.             .Fields("Add_6") + .Fields("Add_7") + .Fields("Add_8") + .Fields("Add_9") + .Fields("Add_10") + _
  706.             .Fields("Add_11") + .Fields("Add_12")
  707.             WglrGrid.TextMatrix(Jsqte, Sydz("026", GridStr(), Szzls)) = IIf(Cur_SumBudget = 0, "", Cur_SumBudget)
  708.             
  709.             
  710.             WglrGrid.TextMatrix(Jsqte, Sydz("027", GridStr(), Szzls)) = IIf(.Fields("YearBudget") = 0, "", .Fields("YearBudget"))
  711.             
  712.             '<<]
  713.             WglrGrid.RowHeight(Jsqte) = Sjhgd
  714.             .MoveNext
  715.             Jsqte = Jsqte + 1
  716.         Loop
  717.     End With
  718.     
  719.     '调整网格
  720.     Call Sub_AdjustGrid
  721.     
  722. End Sub
  723. Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button)             '用户点击工具条
  724.     Dim Msg, Style, Title, Response
  725.     
  726.     '屏蔽文本框,下拉组合框有效性判断
  727.     
  728.     Valilock = True
  729.     
  730.     '屏蔽网格失去焦点产生的有效性判断
  731.     
  732.     changelock = True
  733.     
  734.     Select Case Button.Key
  735.     Case "ymsz"                                          '页面设置
  736.         Dyymctbl.Show 1
  737.     Case "yl"                                            '预 览
  738.         If Fun_Drfrmyxxpd Then
  739.             Call bbyl(True)
  740.         End If
  741.     Case "dy"                                            '打 印
  742.         If Fun_Drfrmyxxpd Then
  743.             Call bbyl(False)
  744.         End If
  745.     Case "sh"                                            '删 行
  746.         Call Scdqfl
  747.     Case "dr"                                            '导入
  748.         Msg = "导入将替换本年已录入的相同科目的预算数据?"   ' 定义信息。
  749.         Style = vbYesNo + vbDefaultButton2 + vbExclamation ' 定义按钮。
  750.         Title = "百利/ERP财务分析系统5.0"   ' 定义标题。
  751.         Response = MsgBox(Msg, Style, Title)
  752.         If Response = vbYes Then   ' 用户按下“是”。
  753.             Call ImportFromLastYear
  754.            
  755.         End If
  756.         
  757.     Case "bz"                                            '帮 助
  758.         Call F1bz
  759.     Case "fh"                                            '退 出
  760.         Unload Me
  761.     End Select
  762.     
  763.     '解 锁
  764.     Valilock = False
  765.     changelock = False
  766.     
  767. End Sub
  768. Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)        '支持热键操作
  769.     If Shift = 2 Then
  770.         Select Case UCase(Chr(KeyCode))
  771.         Case "P"                   'Ctrl+P 打印
  772.             If Tlb_Action.Buttons("dy").Enabled Then
  773.                 Call bbyl(False)
  774.             End If
  775.         End Select
  776.     End If
  777. End Sub
  778. Private Sub Wbkcl()                                                 '文本框录入之前处理(根据实际情况)
  779.     Dim xswbrr As String
  780.     With WglrGrid
  781.         Zdlrqnr = Trim(.Text)
  782.         xswbrr = Trim(.Text)
  783.         
  784.         If GridBoolean(.Col, 3) Then   '列表框录入
  785.             
  786.             '填充列表框程序
  787.             Call FillCombo(YdCombo, GridStr(.Col, 5), xswbrr, 0)
  788.         Else
  789.             Wbkbhlock = True
  790.             
  791.             '====以下为用户自定义
  792.             Ydtext.Text = xswbrr
  793.             '====以上为用户自定义
  794.             
  795.             Wbkbhlock = False
  796.             Ydtext.SelStart = Len(Ydtext.Text)
  797.         End If
  798.     End With
  799. End Sub
  800. Private Function sjzdyxxpd(Dqpdwgh As Long, Dqpdwgl As Long)        '录入数据字段有效性判断,同时进行字段录入事后处理
  801.     Dim Str_JudgeText As String  '临时有效性判断字段内容
  802.     Dim Coljsq As Long           '临时列计数器
  803.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  804.     Dim Dbl_Qcye As Double                 '临时期初余额
  805.     Dim Cur_SumBudget As Currency
  806.     
  807.     With WglrGrid
  808.         
  809.         '非录入状态有效性为合法
  810.         If Yxxpdlock Or .Row < .FixedRows Then
  811.             sjzdyxxpd = True
  812.             Exit Function
  813.         End If
  814.         
  815.         Str_JudgeText = Trim(.TextMatrix(Dqpdwgh, Dqpdwgl))
  816.         Select Case GridStr(Dqpdwgl, 1)
  817.             
  818.             '以下为自定义部分[
  819.             '1.放置字段有效性判断程序
  820.         Case "001"          '科目(如有效则调入科目编码)
  821.             If Len(Str_JudgeText) <> 0 Then
  822.                 SqlStr = "Select * FROM Cwzz_AccCode Where CCode='" & Str_JudgeText & "' OR CName='" & Str_JudgeText & "'"
  823.                 Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  824.                 With RecTemp
  825.                     If .EOF Then
  826.                         Tsxx = "此科目不存在!"
  827.                         GoTo Lrcwcl
  828.                     End If
  829.                     
  830.                     '1.如果科目存在则存储相应预算科目编码
  831.                     WglrGrid.TextMatrix(Dqpdwgh, 2) = Trim(RecTemp.Fields("CCode"))
  832.                     WglrGrid.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls)) = Trim(RecTemp.Fields("CName"))
  833.                 End With
  834.                 
  835.                 '判断记录是否重复
  836.                 SqlStr = "SELECT Cwfx_DeptBudgetMaster.I_id From Cwfx_DeptBudgetMaster WHERE DeptCode='" & Trim(Str_DeptCode) & "' and Ccode='" & WglrGrid.TextMatrix(Dqpdwgh, 2) & "'And Year=" & Str(Int_OriYear)
  837.                 Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  838.                 If Not RecTemp.EOF Then
  839.                     If RecTemp.Fields("I_ID") <> Val(WglrGrid.TextMatrix(Dqpdwgh, 1)) Then
  840.                         Tsxx = "录入记录重复!"
  841.                         Dqpdwgl = Sydz("001", GridStr(), Szzls)
  842.                         GoTo Lrcwcl
  843.                     End If
  844.                 End If
  845.             Else
  846.                 WglrGrid.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls)) = ""
  847.             End If
  848.             
  849.             '以上为自定义部分]
  850.             '科目所要进行核算项不能为空
  851.             If (Not .ColHidden(Sydz("001", GridStr(), Szzls))) And Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))) = "" Then
  852.                 Tsxx = "预算项目不能为空!"
  853.                 Lrywlz = Sydz("001", GridStr(), Szzls)
  854.                 GoTo Lrcwcl
  855.             End If
  856.             
  857.             
  858.         End Select
  859.         '2.放置字段事后处理程序
  860.         Cur_SumBudget = 0
  861.         For I = 2 To 25
  862.             Cur_SumBudget = Cur_SumBudget + Val(WglrGrid.TextMatrix(Dqpdwgh, Sydz(IIf(I > 9, "0", "00") + Trim(Str(I)), GridStr(), Szzls)))
  863.         Next
  864.         WglrGrid.TextMatrix(Dqpdwgh, Sydz("026", GridStr(), Szzls)) = IIf(Cur_SumBudget = 0, "", Cur_SumBudget)
  865.         
  866.         
  867.         '字段录入正确后为零字段清空
  868.         Call Qkwlzd(Dqpdwgh, Dqpdwgl)
  869.         
  870.         sjzdyxxpd = True
  871.         Yxxpdlock = True
  872.         Exit Function
  873.     End With
  874.     
  875.     
  876.     
  877. Lrcwcl:    '录入错误处理
  878.     With WglrGrid
  879.         Call Xtxxts(Tsxx, 0, 1)
  880.         changelock = True
  881.         .Select Dqpdwgh, Dqpdwgl
  882.         changelock = False
  883.         Call xswbk
  884.         sjzdyxxpd = False
  885.         Exit Function
  886.     End With
  887. End Function
  888. Private Function Sjhzyxxpd(ByVal Yxxpdh As Long) As Boolean                  '录入数据行有效性判断,同时进行行处理
  889.     Dim Lrywlz As Long
  890.     Dim RecTemp As New ADODB.Recordset             '临时使用动态集
  891.     Dim SqlStr As String                           '临时连接字符串
  892.     Dim Rec_AccSumAssi As New ADODB.Recordset      '辅助总帐动态集
  893.     Dim Dbl_Now(1 To 16) As Double                 '科目记录现数据
  894.     Dim Str_OriItemCode As String                  '辅助核算项目编码(原)
  895.     Dim Str_NowItemCode As String                  '辅助核算项目编码(现)
  896.     Dim Cur_SumBudget As Currency
  897.     
  898.     With WglrGrid
  899.         
  900.         '判断行为空和无效数据行则清除当前行
  901.         If Yxxpdh > (.Rows - .FixedRows) Then Exit Function
  902.         If .TextMatrix(Yxxpdh, 0) <> "*" Then
  903.             Sjhzyxxpd = True
  904.             Exit Function
  905.         Else
  906.             If pdhwk(Yxxpdh) And Yxxpdh + 1 <= .Rows - 1 Then
  907.                 If .TextMatrix(Yxxpdh + 1, 0) <> "*" Then
  908.                     changelock = True
  909.                     .RemoveItem Yxxpdh
  910.                     If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  911.                         .AddItem ""
  912.                         .RowHeight(.Rows - 1) = Sjhgd
  913.                     End If
  914.                     changelock = False
  915.                     Sjhzyxxpd = True
  916.                     Exit Function
  917.                 End If
  918.             End If
  919.         End If
  920.         
  921.         '行没有发生变化则不进行有效性判断
  922.         If Hyxxpdlock Then
  923.             Sjhzyxxpd = True
  924.             Exit Function
  925.         End If
  926.         
  927.         '以下为自定义部分[
  928.         
  929.         '1.放置行有效性判断程序
  930.         
  931.         '首先进行为空判断(固定不变)
  932.         For Jsqte = Qslz To .Cols - 1
  933.             If (GridInt(Jsqte, 5) = 1 And Len(Trim(.TextMatrix(Yxxpdh, Jsqte))) = 0) Or (GridInt(Jsqte, 5) = 2 And Val(Trim(.TextMatrix(Yxxpdh, Jsqte))) = 0) Then
  934.                 Tsxx = GridStr(Jsqte, 2)
  935.                 Lrywlz = Jsqte
  936.                 GoTo Lrcwcl
  937.                 Exit For
  938.             End If
  939.         Next Jsqte
  940.         
  941.         '科目所要进行核算项不能为空
  942.         If (Not .ColHidden(Sydz("001", GridStr(), Szzls))) And Trim(.TextMatrix(Yxxpdh, Sydz("001", GridStr(), Szzls))) = "" Then
  943.             Tsxx = "预算科目不能为空!"
  944.             Lrywlz = Sydz("001", GridStr(), Szzls)
  945.             GoTo Lrcwcl
  946.         End If
  947.         
  948.         '判断记录是否重复
  949.         SqlStr = "SELECT Cwfx_DeptBudgetMaster.I_id From Cwfx_DeptBudgetMaster WHERE DeptCode='" & Trim(Str_DeptCode) & "' and Ccode='" & WglrGrid.TextMatrix(Yxxpdh, 2) & "'And Year=" & Str(Int_OriYear)
  950.         Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  951.         If Not RecTemp.EOF Then
  952.             If RecTemp.Fields("I_ID") <> Val(WglrGrid.TextMatrix(Yxxpdh, 1)) Then
  953.                 Tsxx = "录入记录重复!"
  954.                 For Jsqte = Qslz To WglrGrid.Cols - 1
  955.                     If Not WglrGrid.ColHidden(Jsqte) Then
  956.                         Lrywlz = Jsqte
  957.                     End If
  958.                 Next Jsqte
  959.                 Lrywlz = Sydz("001", GridStr(), Szzls)
  960.                 GoTo Lrcwcl
  961.             End If
  962.         End If
  963.         
  964.         '2.进行行数据回写
  965.         
  966.         
  967.     End With
  968.     
  969.     On Error GoTo Swcwcl
  970.     
  971.     Cw_DataEnvi.DataConnect.BeginTrans
  972.     
  973.     With Rec_AccSumAssi
  974.         
  975.         If Val(Trim(WglrGrid.TextMatrix(Yxxpdh, 1))) <> 0 Then
  976.             If .State = 1 Then .Close
  977.             .Open "SELECT Cwfx_DeptBudgetMaster.* From Cwfx_DeptBudgetMaster WHERE I_id = " & Val(WglrGrid.TextMatrix(Yxxpdh, 1)), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  978.             
  979.             If Not .EOF Then
  980.                 .Fields("Ccode") = WglrGrid.TextMatrix(Yxxpdh, 2)                '预算科目
  981.                 .Fields("DeptCode") = Trim(Str_DeptCode)
  982.                 .Fields("Year") = Int_OriYear                                           '会计年度
  983.                 .Fields("Budget_1") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("002", GridStr(), Szzls)))
  984.                 .Fields("Add_1") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("003", GridStr(), Szzls)))
  985.                 .Fields("Budget_2") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("004", GridStr(), Szzls)))
  986.                 .Fields("Add_2") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("005", GridStr(), Szzls)))
  987.                 .Fields("Budget_3") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("006", GridStr(), Szzls)))
  988.                 .Fields("Add_3") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("007", GridStr(), Szzls)))
  989.                 .Fields("Budget_4") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("008", GridStr(), Szzls)))
  990.                 .Fields("Add_4") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("009", GridStr(), Szzls)))
  991.                 .Fields("Budget_5") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("010", GridStr(), Szzls)))
  992.                 .Fields("Add_5") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("011", GridStr(), Szzls)))
  993.                 .Fields("Budget_6") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("012", GridStr(), Szzls)))
  994.                 .Fields("Add_6") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("013", GridStr(), Szzls)))
  995.                 .Fields("Budget_7") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("014", GridStr(), Szzls)))
  996.                 .Fields("Add_7") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("015", GridStr(), Szzls)))
  997.                 .Fields("Budget_8") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("016", GridStr(), Szzls)))
  998.                 .Fields("Add_8") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("017", GridStr(), Szzls)))
  999.                 .Fields("Budget_9") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("018", GridStr(), Szzls)))
  1000.                 .Fields("Add_9") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("019", GridStr(), Szzls)))
  1001.                 .Fields("Budget_10") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("020", GridStr(), Szzls)))
  1002.                 .Fields("Add_10") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("021", GridStr(), Szzls)))
  1003.                 .Fields("Budget_11") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("022", GridStr(), Szzls)))
  1004.                 .Fields("Add_11") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("023", GridStr(), Szzls)))
  1005.                 .Fields("Budget_12") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("024", GridStr(), Szzls)))
  1006.                 .Fields("Add_12") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("025", GridStr(), Szzls)))
  1007.                 
  1008.                 .Fields("YearBudget") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("027", GridStr(), Szzls)))
  1009.                 
  1010.                 
  1011.                 .Update
  1012.                 
  1013.                 '更新其他各会计期间数据
  1014.                 
  1015.             End If
  1016.             
  1017.         Else
  1018.             If .State = 1 Then .Close
  1019.             .Open "SELECT Cwfx_DeptBudgetMaster.* From Cwfx_DeptBudgetMaster WHERE I_id = " & Val(WglrGrid.TextMatrix(Yxxpdh, 1)), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  1020.             
  1021.             .AddNew
  1022.             .Fields("Ccode") = Trim(WglrGrid.TextMatrix(Yxxpdh, 2))                                     '预算科目
  1023.             .Fields("DeptCode") = Trim(Str_DeptCode)
  1024.             .Fields("Year") = Int_OriYear                                          '会计年度
  1025.             
  1026.             .Fields("Budget_1") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("002", GridStr(), Szzls)))
  1027.             .Fields("Add_1") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("003", GridStr(), Szzls)))
  1028.             .Fields("Budget_2") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("004", GridStr(), Szzls)))
  1029.             .Fields("Add_2") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("005", GridStr(), Szzls)))
  1030.             .Fields("Budget_3") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("006", GridStr(), Szzls)))
  1031.             .Fields("Add_3") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("007", GridStr(), Szzls)))
  1032.             .Fields("Budget_4") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("008", GridStr(), Szzls)))
  1033.             .Fields("Add_4") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("009", GridStr(), Szzls)))
  1034.             .Fields("Budget_5") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("010", GridStr(), Szzls)))
  1035.             .Fields("Add_5") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("011", GridStr(), Szzls)))
  1036.             .Fields("Budget_6") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("012", GridStr(), Szzls)))
  1037.             .Fields("Add_6") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("013", GridStr(), Szzls)))
  1038.             .Fields("Budget_7") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("014", GridStr(), Szzls)))
  1039.             .Fields("Add_7") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("015", GridStr(), Szzls)))
  1040.             .Fields("Budget_8") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("016", GridStr(), Szzls)))
  1041.             .Fields("Add_8") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("017", GridStr(), Szzls)))
  1042.             .Fields("Budget_9") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("018", GridStr(), Szzls)))
  1043.             .Fields("Add_9") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("019", GridStr(), Szzls)))
  1044.             .Fields("Budget_10") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("020", GridStr(), Szzls)))
  1045.             .Fields("Add_10") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("021", GridStr(), Szzls)))
  1046.             .Fields("Budget_11") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("022", GridStr(), Szzls)))
  1047.             .Fields("Add_11") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("023", GridStr(), Szzls)))
  1048.             .Fields("Budget_12") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("024", GridStr(), Szzls)))
  1049.             .Fields("Add_12") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("025", GridStr(), Szzls)))
  1050.             
  1051.             .Fields("YearBudget") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("027", GridStr(), Szzls)))
  1052.             
  1053.             
  1054.             .Update
  1055.             
  1056.             WglrGrid.TextMatrix(Yxxpdh, 1) = .Fields("I_id")
  1057.             
  1058.             
  1059.         End If
  1060.         
  1061.     End With
  1062.     
  1063.     Cw_DataEnvi.DataConnect.CommitTrans
  1064.     
  1065.     ' <<]
  1066.     
  1067.     '以上为自定义部分]
  1068.     
  1069.     Sjhzyxxpd = True
  1070.     Hyxxpdlock = True
  1071.     Exit Function
  1072.     
  1073. Swcwcl:
  1074.     Cw_DataEnvi.DataConnect.RollbackTrans
  1075.     Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
  1076.     Call Xtxxts(Tsxx, 0, 1)
  1077.     Exit Function
  1078.     
  1079. Lrcwcl:      '录入错误处理
  1080.     With WglrGrid
  1081.         Call Xtxxts(Tsxx, 0, 1)
  1082.         changelock = True
  1083.         .Select Yxxpdh, Lrywlz
  1084.         changelock = False
  1085.         Call xswbk
  1086.         
  1087.         Sjhzyxxpd = False
  1088.         Exit Function
  1089.     End With
  1090. End Function
  1091. '===================以 下 程 序 为 通 用 部 分 ,一 般 不 需 更 改======================='
  1092. Private Sub Sub_AdjustGrid()
  1093.     '调 整 网 格
  1094.     With WglrGrid
  1095.         '加 1 保持一行录入行
  1096.         If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  1097.             .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  1098.             For Jsqte = .FixedRows To .Rows - 1
  1099.                 .RowHeight(Jsqte) = Sjhgd
  1100.             Next Jsqte
  1101.         Else
  1102.             '判断是否有辅助行和录入行,如没有则加行
  1103.             Do While .TextMatrix(.Rows - 1 - Fzxwghs, 0) = "*"
  1104.                 .AddItem ""
  1105.                 .RowHeight(.Rows - 1) = Sjhgd
  1106.             Loop
  1107.         End If
  1108.     End With
  1109. End Sub
  1110. Private Sub Lrzdbz()                                                      '录入字段帮助
  1111.     If Not YdCommand.Visible Then
  1112.         Exit Sub
  1113.     End If
  1114.     Valilock = True
  1115.     With WglrGrid
  1116.         
  1117.         changelock = True        '调入另外窗体必须加锁
  1118.         If .Col = Sydz("001", GridStr(), Szzls) Then
  1119.             Call Drbmhelp(GridInt(.Col, 6), GridStr(.Col, 3), Trim(Ydtext.Text))
  1120.             Str_Ccode = Xtfhcs
  1121.         End If
  1122.         changelock = False
  1123.         If Len(Xtfhcs) <> 0 Then
  1124.             If GridInt(.Col, 7) = 0 Then
  1125.                 Ydtext.Text = Xtfhcs
  1126.             Else
  1127.                 Ydtext.Text = Xtfhcsfz
  1128.             End If
  1129.         End If
  1130.         
  1131.         Valilock = False
  1132.         If Ydtext.Visible Then
  1133.             Ydtext.SetFocus
  1134.         End If
  1135.     End With
  1136. End Sub
  1137. Private Sub Form_Resize()                                                '窗体大小发生变化时,重新显示文本框
  1138.     Call Cxxswbk
  1139. End Sub
  1140. Private Function Fun_Drfrmyxxpd() As Boolean                             '调入其它窗体或功能产生的有效性判断(包括数据回写)
  1141.     Fun_Drfrmyxxpd = True
  1142.     With WglrGrid
  1143.         
  1144.         '如果当前网格处于编辑状态,则先进行数据回写再进行有效性判断
  1145.         
  1146.         If Ydtext.Visible Or YdCombo.Visible Then
  1147.             Call Lrsjhx
  1148.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1149.                 Fun_Drfrmyxxpd = False
  1150.                 Exit Function
  1151.             End If
  1152.         End If
  1153.         
  1154.         '进行行有效性判断
  1155.         If Not Sjhzyxxpd(.Row) Then
  1156.             Fun_Drfrmyxxpd = False
  1157.             Exit Function
  1158.         End If
  1159.         
  1160.     End With
  1161. End Function
  1162. Private Sub WglrGrid_GotFocus()                                     '网格得到焦点
  1163.     
  1164.     '网格得到焦点,如果当前选择行为非数据行
  1165.     '则调整当前焦点至有效数据行
  1166.     
  1167.     With WglrGrid
  1168.         If .Row < .FixedRows And .Rows > .FixedRows Then
  1169.             changelock = True
  1170.             .Select .FixedRows, .Col
  1171.             changelock = False
  1172.         End If
  1173.         If .Col < Qslz Then
  1174.             changelock = True
  1175.             .Select .Row, Qslz
  1176.             changelock = False
  1177.         End If
  1178.     End With
  1179.     
  1180. End Sub
  1181. Private Sub WglrGrid_LostFocus()                                    '录入网格失去焦点
  1182.     
  1183.     '用以屏蔽调用其它窗体时发生网格失去焦点事件
  1184.     If changelock Then
  1185.         Exit Sub
  1186.     End If
  1187.     
  1188.     '引发网格RowcolChange事件
  1189.     With WglrGrid
  1190.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  1191.             .Select 0, 0
  1192.         End If
  1193.     End With
  1194.     
  1195. End Sub
  1196. Private Sub WglrGrid_AfterScroll(ByVal OldTopRow As Long, ByVal OldLeftCol As Long, ByVal NewTopRow As Long, ByVal NewLeftCol As Long)                                       '限制用户在录入过程中滚动鼠标
  1197.     
  1198.     If Gdtlock Then
  1199.         Exit Sub
  1200.     End If
  1201.     
  1202.     With WglrGrid
  1203.         If Ydtext.Visible Or YdCombo.Visible Then
  1204.             Gdtlock = True
  1205.             .TopRow = Dqtoprow
  1206.             .LeftCol = Dqleftcol
  1207.             Gdtlock = False
  1208.             Exit Sub
  1209.         End If
  1210.         
  1211.     End With
  1212. End Sub
  1213. Private Sub WglrGrid_LeaveCell()                                    '离开单元格
  1214.     If changelock Then
  1215.         Exit Sub
  1216.     End If
  1217.     
  1218.     '记录刚刚离开网格单元的行列值
  1219.     Dqlkwgh = WglrGrid.Row
  1220.     Dqlkwgl = WglrGrid.Col
  1221.     
  1222.     '判断是否需要录入数据回写
  1223.     If Not (Ydtext.Visible Or YdCombo.Visible) Then
  1224.         Exit Sub
  1225.     End If
  1226.     Call Lrsjhx
  1227. End Sub
  1228. Private Sub WglrGrid_RowColChange()                                '网格录入行列发生变化时,进行有效性判断
  1229.     Valilock = True       '屏蔽文本框失去焦点进行有效性判断
  1230.     With WglrGrid
  1231.         If changelock Then
  1232.             Exit Sub
  1233.         End If
  1234.         If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1235.             Exit Sub
  1236.         End If
  1237.         If .Row <> Dqlkwgh Then
  1238.             If Not Sjhzyxxpd(Dqlkwgh) Then
  1239.                 Exit Sub
  1240.             End If
  1241.         End If
  1242.     End With
  1243.     Call fhyxh
  1244.     Call Xldql
  1245.     
  1246. End Sub
  1247. Private Sub WglrGrid_DblClick()          '鼠标双击网格显示文本框
  1248.     Dim I As Integer
  1249.     Dim Bln_Add As Boolean
  1250.     Dim CurrentRow As Integer
  1251.     Dim CurrentCol As Integer
  1252.     Let Bln_Add = False
  1253.     
  1254.     With WglrGrid
  1255.         '非数据行退出
  1256.         If .Row < .FixedRows Then
  1257.             Exit Sub
  1258.         End If
  1259.         
  1260.         For I = 3 To 25 Step 2                 '如果是追加列则取月份
  1261.             If .Col = Sydz(IIf(I > 9, "0", "00") + Trim(Str(I)), GridStr(), Szzls) Then
  1262.                 Bln_Add = True
  1263.                 Int_Month = Int(I / 2)
  1264.                 Exit For
  1265.             End If
  1266.         Next
  1267.         
  1268.         On Error GoTo Swcwcl1
  1269.         
  1270.         If Bln_Add Then                       '是追加列调用追加金额form
  1271.             Str_Show = "部门:" + Trim(Str_DeptName) + "  预算科目:" & Trim(.TextMatrix(.Row, Sydz("001", GridStr(), Szzls))) & "  会计年度:" & Trim(Str(Int_OriYear)) & "  月份:" & Trim(Str(Int_Month))
  1272.             Str_TableAdd = "cwfx_DeptBudgetSlaver"
  1273.             Int_I_Id = .TextMatrix(.Row, 1)
  1274.             Str_Title = "部门预算追加金额表"
  1275.             Str_ReportSubTitle = Space(2) + Trim(Str_DeptName) + Space(2) + Fun_FormatOutPut("会计年度:" + Str(Int_OriYear), 30)
  1276.             CurrentRow = .Row
  1277.             CurrentCol = .Col
  1278.             
  1279.             YS_FrmBudgetAdd.HelpContextID = "0411004001"
  1280.             YS_FrmBudgetAdd.Show 1
  1281.             .Row = CurrentRow
  1282.             .Col = CurrentCol
  1283.             
  1284.             .TextMatrix(.Row, .Col) = IIf(Cur_TableAdd = 0, "", Cur_TableAdd)   '金额回写单位格
  1285.             Cur_SumBudget = 0
  1286.             For I = 2 To 25
  1287.                 Cur_SumBudget = Cur_SumBudget + Val(.TextMatrix(.Row, Sydz(IIf(I > 9, "0", "00") + Trim(Str(I)), GridStr(), Szzls)))
  1288.             Next
  1289.             .TextMatrix(.Row, Sydz("026", GridStr(), Szzls)) = IIf(Cur_SumBudget = 0, "", Cur_SumBudget)
  1290.             
  1291.             Hyxxpdlock = False
  1292.             
  1293.         Else
  1294.             Call xswbk
  1295.         End If
  1296.         
  1297.     End With
  1298.     Exit Sub
  1299.     
  1300. Swcwcl1:
  1301.     Tsxx = "先确认本次预算金额的录入才能录入追加金额!"
  1302.     Call Xtxxts(Tsxx, 0, 1)
  1303. End Sub
  1304. Private Sub Ycwbk()                      '隐藏文本框,帮助按钮,列表组合框
  1305.     Valilock = True
  1306.     Ydtext.Visible = False
  1307.     YdCombo.Visible = False
  1308.     YdCommand.Visible = False
  1309. End Sub
  1310. Private Sub YdCombo_KeyDown(KeyCode As Integer, Shift As Integer)        '列表框移动
  1311.     With WglrGrid
  1312.         Select Case KeyCode
  1313.         Case vbKeyEscape                'ESC 键放弃录入
  1314.             Valilock = True
  1315.             .SetFocus
  1316.             Call Ycwbk
  1317.             Valilock = False
  1318.         Case vbKeyReturn                '回 车 键 =13
  1319.             KeyCode = 0
  1320.             .SetFocus
  1321.             Call Lrsjhx
  1322.             Rowjsq = .Row
  1323.             Coljsq = .Col + 1
  1324.             If Coljsq > .Cols - 1 Then
  1325.                 If Rowjsq < .Rows - 1 Then
  1326.                     Rowjsq = Rowjsq + 1
  1327.                 End If
  1328.                 Coljsq = Qslz
  1329.             End If
  1330.             Do While Rowjsq <= .Rows - 1
  1331.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1332.                     Coljsq = Coljsq + 1
  1333.                     If Coljsq > .Cols - 1 Then
  1334.                         Rowjsq = Rowjsq + 1
  1335.                         Coljsq = Qslz
  1336.                     End If
  1337.                 Else
  1338.                     Exit Do
  1339.                 End If
  1340.             Loop
  1341.             .Select Rowjsq, Coljsq
  1342.         Case vbKeyLeft                  '左 箭 头 =37
  1343.             If .Col - 1 = Qslz Then
  1344.                 If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1345.                     GoTo jzzx
  1346.                 End If
  1347.             End If
  1348.             If .Col > Qslz Then
  1349.                 KeyCode = 0
  1350.                 .SetFocus
  1351.                 Call Lrsjhx
  1352.                 Coljsq = .Col - 1
  1353.                 Do While Coljsq > Qslz
  1354.                     If Coljsq - 1 = Qslz Then
  1355.                         If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1356.                             GoTo jzzx
  1357.                         End If
  1358.                     End If
  1359.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1360.                         Coljsq = Coljsq - 1
  1361.                     Else
  1362.                         Exit Do
  1363.                     End If
  1364.                 Loop
  1365.                 .Select .Row, Coljsq
  1366.             End If
  1367.             
  1368.         Case vbKeyRight                 '右 箭 头 =39
  1369.             KeyCode = 0
  1370.             .SetFocus
  1371.             Call Lrsjhx
  1372.             Rowjsq = .Row
  1373.             Coljsq = .Col + 1
  1374.             If Coljsq > .Cols - 1 Then
  1375.                 If Rowjsq < .Rows - 1 Then
  1376.                     Rowjsq = Rowjsq + 1
  1377.                 End If
  1378.                 Coljsq = Qslz
  1379.             End If
  1380.             Do While Rowjsq <= .Rows - 1
  1381.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1382.                     Coljsq = Coljsq + 1
  1383.                     If Coljsq > .Cols - 1 Then
  1384.                         Rowjsq = Rowjsq + 1
  1385.                         Coljsq = Qslz
  1386.                     End If
  1387.                 Else
  1388.                     Exit Do
  1389.                 End If
  1390.             Loop
  1391.             .Select Rowjsq, Coljsq
  1392.         Case Else
  1393.         End Select
  1394.         
  1395. jzzx:
  1396.         
  1397.     End With
  1398. End Sub
  1399. Private Sub YdCombo_LostFocus()
  1400.     With WglrGrid                                    '因为选中网格会先发生Rowcolchange事件置Valiock
  1401.         If Not Valilock Then                           '为TRUE
  1402.             Call Lrsjhx
  1403.             If Not Sjhzyxxpd(Dqlrwgh) Then
  1404.                 Exit Sub
  1405.             End If
  1406.         End If
  1407.     End With
  1408. End Sub
  1409. Private Sub Ydcommand_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
  1410.     Call Lrzdbz
  1411. End Sub
  1412. Private Sub ydtext_KeyDown(KeyCode As Integer, Shift As Integer)
  1413.     Dim Rowjsq As Long, Coljsq As Long
  1414.     With WglrGrid
  1415.         Select Case KeyCode
  1416.         Case vbKeyF2
  1417.             Call Lrzdbz
  1418.         Case vbKeyEscape                'ESC 键放弃录入
  1419.             Valilock = True
  1420.             Call Ycwbk
  1421.             .SetFocus
  1422.         Case vbKeyReturn                '回 车 键 =13
  1423.             KeyCode = 0
  1424.             .SetFocus
  1425.             Call Lrsjhx
  1426.             Rowjsq = .Row
  1427.             Coljsq = .Col + 1
  1428.             If Coljsq > .Cols - 1 Then
  1429.                 If Rowjsq < .Rows - 1 Then
  1430.                     Rowjsq = Rowjsq + 1
  1431.                 End If
  1432.                 Coljsq = Qslz
  1433.             End If
  1434.             Do While Rowjsq <= .Rows - 1
  1435.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1436.                     Coljsq = Coljsq + 1
  1437.                     If Coljsq > .Cols - 1 Then
  1438.                         Rowjsq = Rowjsq + 1
  1439.                         Coljsq = Qslz
  1440.                     End If
  1441.                 Else
  1442.                     Exit Do
  1443.                 End If
  1444.             Loop
  1445.             If Rowjsq <= .Rows - 1 Then
  1446.                 .Select Rowjsq, Coljsq
  1447.             End If
  1448.         Case vbKeyUp                    '上 箭 头 =38
  1449.             KeyCode = 0
  1450.             .SetFocus
  1451.             Call Lrsjhx
  1452.             If .Row > .FixedRows Then
  1453.                 .Row = .Row - 1
  1454.             End If
  1455.         Case vbKeyDown                  '下 箭 头 =40
  1456.             KeyCode = 0
  1457.             .SetFocus
  1458.             Call Lrsjhx
  1459.             If .Row < .Rows - 1 Then
  1460.                 .Row = .Row + 1
  1461.             End If
  1462.         Case vbKeyLeft                  '左 箭 头 =37
  1463.             If .Col - 1 = Qslz Then
  1464.                 If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1465.                     GoTo jzzx
  1466.                 End If
  1467.             End If
  1468.             If Ydtext.SelStart = 0 And .Col > Qslz Then
  1469.                 KeyCode = 0
  1470.                 .SetFocus
  1471.                 Call Lrsjhx
  1472.                 Coljsq = .Col - 1
  1473.                 Do While Coljsq > Qslz
  1474.                     If Coljsq - 1 = Qslz Then
  1475.                         If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1476.                             GoTo jzzx
  1477.                         End If
  1478.                     End If
  1479.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1480.                         Coljsq = Coljsq - 1
  1481.                     Else
  1482.                         Exit Do
  1483.                     End If
  1484.                 Loop
  1485.                 .Select .Row, Coljsq
  1486.             End If
  1487. jzzx:
  1488.             
  1489.             
  1490.         Case vbKeyRight                 '右 箭 头 =39
  1491.             wblong = Len(Ydtext.Text)
  1492.             If (Ydtext.SelStart = wblong Or Ydtext.SelLength = wblong) Then
  1493.                 KeyCode = 0
  1494.                 .SetFocus
  1495.                 Call Lrsjhx
  1496.                 Rowjsq = .Row
  1497.                 Coljsq = .Col + 1
  1498.                 If Coljsq > .Cols - 1 Then
  1499.                     If Rowjsq < .Rows - 1 Then
  1500.                         Rowjsq = Rowjsq + 1
  1501.                     End If
  1502.                     Coljsq = Qslz
  1503.                 End If
  1504.                 Do While Rowjsq <= .Rows - 1
  1505.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1506.                         Coljsq = Coljsq + 1
  1507.                         If Coljsq > .Cols - 1 Then
  1508.                             Rowjsq = Rowjsq + 1
  1509.                             Coljsq = Qslz
  1510.                         End If
  1511.                     Else
  1512.                         Exit Do
  1513.                     End If
  1514.                 Loop
  1515.                 .Select Rowjsq, Coljsq
  1516.             End If
  1517.         Case Else
  1518.         End Select
  1519.     End With
  1520. End Sub
  1521. Private Sub ydtext_KeyPress(KeyAscii As Integer)         '录入字符事中控制
  1522.     Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
  1523.     If KeyAscii <> 0 Then
  1524.         Call Xyxhbz(Dqlrwgh)
  1525.     End If
  1526. End Sub
  1527. Private Sub ydtext_Change()                              '录入事中变化处理
  1528.     
  1529.     '防止程序改变但不进行处理
  1530.     
  1531.     If Wbkbhlock Then
  1532.         Exit Sub
  1533.     End If
  1534.     
  1535.     With WglrGrid
  1536.         
  1537.         '限制字段录入长度
  1538.         Wbkbhlock = True
  1539.         Select Case GridInt(.Col, 1)
  1540.         Case 8
  1541.             Call Sjgskz(Ydtext, Xtjezws - Xtjexsws - 1, Xtjexsws)
  1542.         Case 9
  1543.             Call Sjgskz(Ydtext, Xtslzws - Xtslxsws - 1, Xtslxsws)
  1544.         Case 10
  1545.             Call Sjgskz(Ydtext, Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
  1546.         Case Else
  1547.             If GridInt(.Col, 3) <> 0 Or GridInt(.Col, 4) <> 0 Then
  1548.                 Call Sjgskz(Ydtext, GridInt(.Col, 3), GridInt(.Col, 4))
  1549.             End If
  1550.         End Select
  1551.         Wbkbhlock = False
  1552.     End With
  1553. End Sub
  1554. Private Sub ydtext_LostFocus()            '如果由于选中网格之外的控件而发生有效性判断(选中网格会先发生Rowcolchange事件置Valiock为TRUE)
  1555.     With WglrGrid
  1556.         If Not Valilock Then
  1557.             Call Lrsjhx
  1558.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1559.                 Exit Sub
  1560.             End If
  1561.             If Not Sjhzyxxpd(Dqlrwgh) Then
  1562.                 Exit Sub
  1563.             End If
  1564.         End If
  1565.     End With
  1566. End Sub
  1567. Private Sub xswbk()                       '在当前选中单元显示文本框,列表框,帮助按钮(通用)
  1568.     Dim Wbkpy As Integer, Wbkpy1 As Integer '文本框偏移量
  1569.     
  1570.     '如果单据操作状态为浏览状态则不能显示录入载体
  1571.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1572.         Exit Sub
  1573.     End If
  1574.     
  1575.     '显示文本框前返回有效行列(解决滚动条问题)
  1576.     Call Xldqh
  1577.     Call Xldql
  1578.     
  1579.     '隐藏文本框,帮助按钮,列表组合框
  1580.     Call Ycwbk
  1581.     
  1582.     With WglrGrid
  1583.         Dqlrwgh = .Row
  1584.         Dqlrwgl = .Col
  1585.         If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  1586.             Exit Sub
  1587.         End If
  1588.         
  1589.         Wbkpy = 30
  1590.         Wbkpy1 = 15
  1591.         
  1592.         If GridBoolean(.Col, 3) Then
  1593.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  1594.             YdCombo.Top = .CellTop + .Top + Wbkpy
  1595.             YdCombo.Width = .CellWidth - Wbkpy1
  1596.             Call Wbkcl
  1597.             YdCombo.Visible = True
  1598.             YdCombo.SetFocus
  1599.             YdCommand.Visible = False
  1600.             Ydtext.Visible = False
  1601.         Else
  1602.             If GridBoolean(.Col, 2) Then
  1603.                 YdCommand.Left = .Left + .CellLeft + .CellWidth - YdCommand.Width + Wbkpy
  1604.                 YdCommand.Top = .Top + .CellTop + .CellHeight - YdCommand.Height + Wbkpy
  1605.                 YdCommand.Visible = True
  1606.             Else
  1607.                 YdCommand.Visible = False
  1608.             End If
  1609.             
  1610.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  1611.             Ydtext.Top = .CellTop + .Top + Wbkpy
  1612.             If YdCommand.Visible Then
  1613.                 If Sfblbzkd Then
  1614.                     Ydtext.Width = .CellWidth - YdCommand.Width
  1615.                 Else
  1616.                     Ydtext.Width = .CellWidth - Wbkpy1
  1617.                 End If
  1618.             Else
  1619.                 Ydtext.Width = .CellWidth - Wbkpy1
  1620.             End If
  1621.             Ydtext.Height = .CellHeight - Wbkpy1
  1622.             
  1623.             If GridInt(.Col, 2) <> 0 Then
  1624.                 Ydtext.MaxLength = GridInt(.Col, 2)
  1625.             Else
  1626.                 Ydtext.MaxLength = 3000
  1627.             End If
  1628.             
  1629.             Call Wbkcl
  1630.             
  1631.             Ydtext.Visible = True
  1632.             Ydtext.SetFocus
  1633.         End If
  1634.         Dqtoprow = .TopRow
  1635.         Dqleftcol = .LeftCol
  1636.         
  1637.         '重置锁值
  1638.         Valilock = False
  1639.         Wbkbhlock = False
  1640.     End With
  1641. End Sub
  1642. Private Sub Cxxswbk()                                                  'Formresize中重新显示文本框,列表框,帮助按钮(通用)
  1643.     
  1644.     Dim Wbkpy As Integer, Wbkpy1 As Integer
  1645.     Wbkpy = 30
  1646.     Wbkpy1 = 15
  1647.     With WglrGrid
  1648.         If YdCombo.Visible Then
  1649.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  1650.             YdCombo.Top = .CellTop + .Top + Wbkpy
  1651.             YdCombo.Width = .CellWidth - Wbkpy1
  1652.         End If
  1653.         If YdCommand.Visible Then
  1654.             YdCommand.Left = .Left + .CellLeft + .CellWidth - YdCommand.Width + Wbkpy
  1655.             YdCommand.Top = .Top + .CellTop + .CellHeight - YdCommand.Height + Wbkpy
  1656.         End If
  1657.         If Ydtext.Visible Then
  1658.             If YdCommand.Visible Then
  1659.                 If Sfblbzkd Then
  1660.                     Ydtext.Width = .CellWidth - YdCommand.Width
  1661.                 Else
  1662.                     Ydtext.Width = .CellWidth - Wbkpy1
  1663.                 End If
  1664.             Else
  1665.                 Ydtext.Width = .CellWidth - Wbkpy1
  1666.             End If
  1667.             
  1668.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  1669.             Ydtext.Top = .CellTop + .Top + Wbkpy
  1670.             Ydtext.Height = .CellHeight - Wbkpy1
  1671.         End If
  1672.     End With
  1673.     
  1674. End Sub
  1675. Private Sub Lrsjhx()                                                   '文本框录入数据回写
  1676.     With WglrGrid
  1677.         If YdCombo.Visible Then
  1678.             .Text = Trim(YdCombo.Text)
  1679.         End If
  1680.         If Ydtext.Visible Then
  1681.             .Text = Trim(Ydtext.Text)
  1682.         End If
  1683.         
  1684.         '(如果字段录入内容发生变化,则打开有效性判断锁)
  1685.         If Zdlrqnr <> Trim(.Text) Then
  1686.             Yxxpdlock = False
  1687.             Hyxxpdlock = False
  1688.         End If
  1689.         
  1690.         '如果字段录入内容不为空则写数据行有效性标志
  1691.         
  1692.         If Len(Trim(.Text)) <> 0 Then
  1693.             Call Xyxhbz(.Row)
  1694.         End If
  1695.         
  1696.         '隐藏文本框,帮助按钮,列表组合框
  1697.         Call Ycwbk
  1698.         
  1699.     End With
  1700. End Sub
  1701. Private Sub WglrGrid_KeyDown(KeyCode As Integer, Shift As Integer)    '网格录入增行,删行快捷键
  1702.     
  1703.     '如果单据操作状态为浏览状态则不能显示录入载体
  1704.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1705.         Exit Sub
  1706.     End If
  1707.     
  1708.     Select Case KeyCode
  1709.     Case vbKeyDelete               '删行
  1710.         Call Scdqfl
  1711.     Case vbKeyInsert               '增行
  1712.         Call zjlrfl
  1713.     End Select
  1714. End Sub
  1715. Private Sub WglrGrid_KeyPress(KeyAscii As Integer)                     '网格接受键盘录入
  1716.     Dim Str_ChangeTe As String    '临时交换内容
  1717.     Dim Coljsq As Long            '临时列计数器
  1718.     Dim Int_SaveKey As Integer    '保存KeyAscii值
  1719.     
  1720.     '如果单据操作状态为浏览状态则不能显示录入载体
  1721.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1722.         Exit Sub
  1723.     End If
  1724.     
  1725.     Int_SaveKey = KeyAscii
  1726.     
  1727.     With WglrGrid
  1728.         '屏 蔽 回 车 键
  1729.         If KeyAscii = vbKeyReturn Then
  1730.             KeyAscii = 0
  1731.             Rowjsq = .Row
  1732.             Coljsq = .Col + 1
  1733.             If Coljsq > .Cols - 1 Then
  1734.                 If Rowjsq < .Rows - 1 Then
  1735.                     Rowjsq = Rowjsq + 1
  1736.                 End If
  1737.                 Coljsq = Qslz
  1738.             End If
  1739.             Do While Rowjsq <= .Rows - 1
  1740.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1741.                     Coljsq = Coljsq + 1
  1742.                     If Coljsq > .Cols - 1 Then
  1743.                         Rowjsq = Rowjsq + 1
  1744.                         Coljsq = Qslz
  1745.                     End If
  1746.                 Else
  1747.                     Exit Do
  1748.                 End If
  1749.             Loop
  1750.             If Rowjsq <= .Rows - 1 Then
  1751.                 .Select Rowjsq, Coljsq
  1752.             End If
  1753.             Exit Sub
  1754.         End If
  1755.         '接受用户录入
  1756.         Select Case KeyAscii
  1757.         Case 0 To 32
  1758.             
  1759.             '显示录入载体
  1760.             Call xswbk
  1761.             
  1762.         Case Else
  1763.             
  1764.             '防止非编辑字段SendKeys()出现死循环
  1765.             If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  1766.                 Exit Sub
  1767.             End If
  1768.             
  1769.             If GridBoolean(.Col, 3) Then
  1770.                 
  1771.                 '列表框录入
  1772.                 Call xswbk
  1773.                 
  1774.             Else
  1775.                 
  1776.                 Ydtext.Text = ""
  1777.                 Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
  1778.                 If KeyAscii = 0 Then
  1779.                     Exit Sub
  1780.                 End If
  1781.                 
  1782.                 '写有效行数据标志
  1783.                 Call Xyxhbz(.Row)
  1784.                 Call xswbk
  1785.                 Ydtext.Text = ""
  1786.                 Valilock = True
  1787.                 SendKeys Chr(KeyAscii), wait
  1788.                 DoEvents
  1789.                 Valilock = False
  1790.                 
  1791.             End If
  1792.         End Select
  1793.     End With
  1794. End Sub
  1795. Private Sub zjlrfl()                                                    '增加录入分录
  1796.     With WglrGrid
  1797.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  1798.             If Not Fun_Drfrmyxxpd Then
  1799.                 Exit Sub
  1800.             End If
  1801.         Else
  1802.             Exit Sub
  1803.         End If
  1804.         If .Row < .FixedRows Then
  1805.             Exit Sub
  1806.         End If
  1807.         .AddItem "", .Row
  1808.         .RowHeight(.Row) = Sjhgd
  1809.         
  1810.         
  1811.         If .Row <> .Rows - 1 Then
  1812.             If .TextMatrix(.Row + 1, 0) = "*" Then
  1813.                 .TextMatrix(.Row, 0) = "*"
  1814.             Else
  1815.                 .RemoveItem .Rows - 1
  1816.             End If
  1817.         End If
  1818.         Call Xldqh
  1819.         Call Xldql
  1820.         Hyxxpdlock = False
  1821.     End With
  1822. End Sub
  1823. Private Sub Scdqfl()                                                    '删除当前分录
  1824.     Dim Answer As Integer, Scqwghz As Long, Scqwglz As Long, Hjlzte As Long, Sflrzt As Boolean
  1825.     Dim RecTemp As New ADODB.Recordset             '临时使用动态集
  1826.     Dim SqlStr As String                           '临时连接字符串
  1827.     Dim Str_NowItemCode As String                  '辅助核算项目编码(现)
  1828.     
  1829.     With WglrGrid
  1830.         Scqwghz = .Row
  1831.         Scqwglz = .Col
  1832.         If .TextMatrix(.Row, 0) = "*" Then
  1833.             
  1834.             '判断是否为录入状态
  1835.             If Ydtext.Visible Or YdCombo.Visible Then
  1836.                 Sflrzt = True
  1837.                 Validate = True
  1838.                 Call Lrsjhx
  1839.                 Validate = False
  1840.             End If
  1841.             
  1842.             Call Xldqh
  1843.             changelock = True
  1844.             .Select .Row, 0
  1845.             changelock = False
  1846.             If Shsfts Then
  1847.                 .Cell(flexcpBackColor, .Row, Qslz, .Row, .Cols - 1) = QBColor(12)
  1848.                 Tsxx = "请确认是否删除当前记录?"
  1849.                 yhAnswer = Xtxxts(Tsxx, 2, 2)
  1850.                 If yhAnswer = 2 Then
  1851.                     .Cell(flexcpBackColor, .Row, Qslz, .Row, .Cols - 1) = &H80000005
  1852.                     changelock = True
  1853.                     .Select Scqwghz, Scqwglz
  1854.                     changelock = False
  1855.                     
  1856.                     '如为录入状态,则恢复录入
  1857.                     If Sflrzt Then
  1858.                         Call xswbk
  1859.                     End If
  1860.                     
  1861.                     Exit Sub
  1862.                 End If
  1863.             End If
  1864.             
  1865.             On Error GoTo Swcwcl
  1866.             
  1867.             Cw_DataEnvi.DataConnect.BeginTrans
  1868.             
  1869.             If Val(WglrGrid.TextMatrix(.Row, 1)) <> 0 Then
  1870.                 SqlStr = "SELECT i_id From Cwfx_DeptBudgetMaster WHERE  I_id=" & Val(WglrGrid.TextMatrix(.Row, 1))
  1871.                 Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  1872.                 If Not RecTemp.EOF Then
  1873.                     SqlStr = "Delete Cwfx_DeptBudgetMaster Where I_id=" & Val(WglrGrid.TextMatrix(.Row, 1))
  1874.                     Cw_DataEnvi.DataConnect.Execute (SqlStr)
  1875.                 End If
  1876.             End If
  1877.             
  1878.             Cw_DataEnvi.DataConnect.CommitTrans
  1879.             
  1880.             .RemoveItem .Row
  1881.             
  1882.             If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  1883.                 .AddItem ""
  1884.                 .RowHeight(.Rows - 1) = Sjhgd
  1885.             End If
  1886.             changelock = True
  1887.             .Select .Row, Scqwglz
  1888.             changelock = False
  1889.             
  1890.         End If
  1891.     End With
  1892.     
  1893.     Exit Sub
  1894.     
  1895.     '[>>事务错误处理
  1896. Swcwcl:
  1897.     Cw_DataEnvi.DataConnect.RollbackTrans
  1898.     txss = "删除过程中出现错误!"
  1899.     Call Xtxxts(Tsxx, 0, 1)
  1900.     Exit Sub
  1901.     '<<]
  1902. End Sub
  1903. Private Sub Qkwlzd(sjh As Long, Sjl As Long)                            '清空为零字段
  1904.     If Not GridBoolean(Sjl, 5) Then
  1905.         Exit Sub
  1906.     End If
  1907.     With WglrGrid
  1908.         If Val(Trim(.TextMatrix(sjh, Sjl))) = 0 Then
  1909.             .TextMatrix(sjh, Sjl) = ""
  1910.         End If
  1911.     End With
  1912. End Sub
  1913. Private Sub fhyxh()                                                     '返回录入数据有效行,同时让得到焦点网格可见
  1914.     With WglrGrid
  1915.         If .Row >= .FixedRows Then
  1916.             If .TextMatrix(.Row, 0) <> "*" Then
  1917.                 For Rowjsq = .FixedRows To .Rows - 1
  1918.                     If .TextMatrix(Rowjsq, 0) <> "*" Then
  1919.                         Exit For
  1920.                     End If
  1921.                 Next Rowjsq
  1922.                 If Rowjsq <= .Rows - 1 Then
  1923.                     changelock = True
  1924.                     .Select Rowjsq, .Col
  1925.                     changelock = False
  1926.                 Else
  1927.                     changelock = True
  1928.                     .Select .Rows - 1, .Col
  1929.                     changelock = False
  1930.                 End If
  1931.             End If
  1932.             Call Xldqh
  1933.         End If
  1934.     End With
  1935. End Sub
  1936. Private Sub Xldqh()                                                      '显露当前行
  1937.     Dim Toprowte As Long
  1938.     With WglrGrid
  1939.         Toprowte = 0
  1940.         Do While .CellTop + .RowHeight(.Row) + Fzxwghs * Sjhgd > .Height And .TopRow <> Toprowte
  1941.             Toprowte = .TopRow
  1942.             .TopRow = .TopRow + 1
  1943.         Loop
  1944.         Toprowte = 0
  1945.         Do While .CellTop < .FixedRows * .RowHeight(0) And .TopRow <> Toprowte
  1946.             Toprowte = .TopRow
  1947.             .TopRow = .TopRow - 1
  1948.         Loop
  1949.     End With
  1950. End Sub
  1951. Private Sub Xldql()                                                     '显露当前列
  1952.     Dim Leftcolte As Long
  1953.     With WglrGrid
  1954.         If .Col >= Qslz Then
  1955.             If .LeftCol > .Col Then
  1956.                 .LeftCol = .Col
  1957.             End If
  1958.             Leftcolte = 0
  1959.             Do While .CellLeft + .CellWidth > .Width And .LeftCol <> Leftcolte
  1960.                 Leftcolte = .LeftCol
  1961.                 .LeftCol = .LeftCol + 1
  1962.             Loop
  1963.         End If
  1964.     End With
  1965. End Sub
  1966. Private Function pdhwk(sjh As Long)                                     '判断网格行是否为空行(所有录入字段均为空*非录入字段除外)
  1967.     With WglrGrid
  1968.         For Coljsq = Qslz To .Cols - 1
  1969.             If Len(Trim(.TextMatrix(sjh, Coljsq))) <> 0 And GridBoolean(Coljsq, 1) Then
  1970.                 pdhwk = False
  1971.                 Exit Function
  1972.             End If
  1973.         Next Coljsq
  1974.         pdhwk = True
  1975.     End With
  1976. End Function
  1977. Private Sub Xyxhbz(sjh As Long)                                         '写行有效性标志,并判断是否增行
  1978.     With WglrGrid
  1979.         If .TextMatrix(sjh, 0) = "*" Then
  1980.             Exit Sub
  1981.         End If
  1982.         .TextMatrix(sjh, 0) = "*"
  1983.         If sjh >= .Rows - Fzxwghs - 1 Then
  1984.             .AddItem ""
  1985.             .RowHeight(.Rows - 1) = Sjhgd
  1986.         End If
  1987.     End With
  1988. End Sub
  1989. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)   '表格格式设置(通用)
  1990.     Select Case Button.Key
  1991.     Case "bcgs"                              '保存表格格式
  1992.         Call Bcwggs(WglrGrid, GridCode, GridStr())
  1993.     Case "hfmrgs"                            '恢复默认格式
  1994.         Call Hfmrgs(WglrGrid, GridCode, GridStr())
  1995.     End Select
  1996. End Sub
  1997. Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
  1998.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  1999.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  2000.     Bbxbtgs = 1                                          '报 表 小 标 题 行 数
  2001.     Bbbwhgs = 0                                          '报 表 表 尾 行 数
  2002.     ReDim Bbxbt(1 To Bbxbtgs)
  2003.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  2004.     If Bbbwhgs <> 0 Then
  2005.         ReDim Bbbwh(1 To Bbbwhgs)
  2006.         ReDim Bbbwhzzxs(1 To Bbbwhgs)
  2007.     End If
  2008.     Bbzbt = ReportTitle
  2009.     Bbxbt(1) = Space(2) + "部门:" + Trim(Str_DeptName) + Space(10) + Fun_FormatOutPut("会计年度:" + Trim(lbl_AccountYear.Caption), 30)
  2010.     
  2011.     Call Scyxsjb(WglrGrid)                               '生成报表数据
  2012.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  2013.     If Not bbylte Then
  2014.         Unload DY_Tybbyldy
  2015.     End If
  2016. End Sub
  2017. Private Sub ImportFromLastYear()
  2018.     SqlStr = "update cwfx_Deptbudgetmaster set "
  2019.     SqlStr = SqlStr + "cwfx_Deptbudgetmaster.budget_1=n.budget_1+n.add_1,"
  2020.     SqlStr = SqlStr + "cwfx_Deptbudgetmaster.budget_2=n.budget_2+n.add_2,"
  2021.     SqlStr = SqlStr + "cwfx_Deptbudgetmaster.budget_3=n.budget_3+n.add_3,"
  2022.     SqlStr = SqlStr + "cwfx_Deptbudgetmaster.budget_4=n.budget_4+n.add_4,"
  2023.     SqlStr = SqlStr + "cwfx_Deptbudgetmaster.budget_5=n.budget_5+n.add_5,"
  2024.     SqlStr = SqlStr + "cwfx_Deptbudgetmaster.budget_6=n.budget_6+n.add_6,"
  2025.     SqlStr = SqlStr + "cwfx_Deptbudgetmaster.budget_7=n.budget_7+n.add_7,"
  2026.     SqlStr = SqlStr + "cwfx_Deptbudgetmaster.budget_8=n.budget_8+n.add_8,"
  2027.     SqlStr = SqlStr + "cwfx_Deptbudgetmaster.budget_9=n.budget_9+n.add_9,"
  2028.     SqlStr = SqlStr + "cwfx_Deptbudgetmaster.budget_10=n.budget_10+n.add_10,"
  2029.     SqlStr = SqlStr + "cwfx_Deptbudgetmaster.budget_11=n.budget_11+n.add_11,"
  2030.     SqlStr = SqlStr + "cwfx_Deptbudgetmaster.budget_12 = n.budget_12 + n.add_12 "
  2031.     
  2032.     SqlStr = SqlStr + "from cwfx_Deptbudgetmaster,cwfx_Deptbudgetmaster as n "
  2033.     SqlStr = SqlStr + "Where cwfx_Deptbudgetmaster.ccode = n.ccode And "
  2034.     SqlStr = SqlStr + "cwfx_Deptbudgetmaster.deptcode = n.deptcode And "
  2035.     SqlStr = SqlStr + "cwfx_Deptbudgetmaster.deptcode = '" & Trim(Str_DeptCode) & "' And "
  2036.     SqlStr = SqlStr + "cwfx_Deptbudgetmaster.Year =" & Int_OriYear & " And n.Year =" & Int_OriYear - 1
  2037.     Cw_DataEnvi.DataConnect.Execute (SqlStr)
  2038.     Tsxx = "导入完毕"
  2039.     Call Xtxxts(Tsxx, 0, 4)
  2040.     
  2041. End Sub