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

企业管理

开发平台:

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 Cg_FrmPlanSplit 
  5.    BackColor       =   &H00E9F4FA&
  6.    BorderStyle     =   3  'Fixed Dialog
  7.    Caption         =   "采购计划拆分"
  8.    ClientHeight    =   6555
  9.    ClientLeft      =   45
  10.    ClientTop       =   330
  11.    ClientWidth     =   9915
  12.    Icon            =   "采购系统_采购计划拆分.frx":0000
  13.    KeyPreview      =   -1  'True
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   6555
  18.    ScaleWidth      =   9915
  19.    ShowInTaskbar   =   0   'False
  20.    StartUpPosition =   1  '所有者中心
  21.    Begin VB.ComboBox YdCombo 
  22.       Height          =   300
  23.       Left            =   7890
  24.       Style           =   2  'Dropdown List
  25.       TabIndex        =   11
  26.       Top             =   1080
  27.       Visible         =   0   'False
  28.       Width           =   1151
  29.    End
  30.    Begin VB.CommandButton Ydcommand 
  31.       CausesValidation=   0   'False
  32.       Height          =   299
  33.       Left            =   9600
  34.       Picture         =   "采购系统_采购计划拆分.frx":1042
  35.       Style           =   1  'Graphical
  36.       TabIndex        =   1
  37.       Top             =   570
  38.       Visible         =   0   'False
  39.       Width           =   283
  40.    End
  41.    Begin VB.CommandButton YdCommand1 
  42.       CausesValidation=   0   'False
  43.       Height          =   299
  44.       Left            =   9600
  45.       Picture         =   "采购系统_采购计划拆分.frx":13CC
  46.       Style           =   1  'Graphical
  47.       TabIndex        =   9
  48.       Top             =   870
  49.       Visible         =   0   'False
  50.       Width           =   283
  51.    End
  52.    Begin VB.TextBox Ydtext 
  53.       BackColor       =   &H80000018&
  54.       BorderStyle     =   0  'None
  55.       ForeColor       =   &H00000000&
  56.       Height          =   339
  57.       Left            =   7770
  58.       MultiLine       =   -1  'True
  59.       TabIndex        =   2
  60.       Top             =   630
  61.       Visible         =   0   'False
  62.       Width           =   1181
  63.    End
  64.    Begin VSFlex8Ctl.VSFlexGrid WglrGrid 
  65.       Height          =   4530
  66.       Left            =   60
  67.       TabIndex        =   0
  68.       Top             =   1830
  69.       Width           =   9570
  70.       _cx             =   5080
  71.       _cy             =   5080
  72.       Appearance      =   1
  73.       BorderStyle     =   1
  74.       Enabled         =   -1  'True
  75.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  76.          Name            =   "宋体"
  77.          Size            =   9
  78.          Charset         =   134
  79.          Weight          =   400
  80.          Underline       =   0   'False
  81.          Italic          =   0   'False
  82.          Strikethrough   =   0   'False
  83.       EndProperty
  84.       MousePointer    =   0
  85.       BackColor       =   16777215
  86.       ForeColor       =   0
  87.       BackColorFixed  =   14671839
  88.       ForeColorFixed  =   0
  89.       BackColorSel    =   -2147483643
  90.       ForeColorSel    =   -2147483639
  91.       BackColorBkg    =   -2147483636
  92.       BackColorAlternate=   16777215
  93.       GridColor       =   -2147483633
  94.       GridColorFixed  =   -2147483632
  95.       TreeColor       =   -2147483632
  96.       FloodColor      =   192
  97.       SheetBorder     =   -2147483642
  98.       FocusRect       =   1
  99.       HighLight       =   1
  100.       AllowSelection  =   0   'False
  101.       AllowBigSelection=   0   'False
  102.       AllowUserResizing=   1
  103.       SelectionMode   =   0
  104.       GridLines       =   1
  105.       GridLinesFixed  =   2
  106.       GridLineWidth   =   1
  107.       Rows            =   5000
  108.       Cols            =   10
  109.       FixedRows       =   1
  110.       FixedCols       =   0
  111.       RowHeightMin    =   0
  112.       RowHeightMax    =   0
  113.       ColWidthMin     =   0
  114.       ColWidthMax     =   0
  115.       ExtendLastCol   =   0   'False
  116.       FormatString    =   ""
  117.       ScrollTrack     =   0   'False
  118.       ScrollBars      =   3
  119.       ScrollTips      =   0   'False
  120.       MergeCells      =   0
  121.       MergeCompare    =   0
  122.       AutoResize      =   -1  'True
  123.       AutoSizeMode    =   0
  124.       AutoSearch      =   0
  125.       AutoSearchDelay =   2
  126.       MultiTotals     =   -1  'True
  127.       SubtotalPosition=   1
  128.       OutlineBar      =   0
  129.       OutlineCol      =   0
  130.       Ellipsis        =   0
  131.       ExplorerBar     =   0
  132.       PicturesOver    =   0   'False
  133.       FillStyle       =   0
  134.       RightToLeft     =   0   'False
  135.       PictureType     =   0
  136.       TabBehavior     =   0
  137.       OwnerDraw       =   0
  138.       Editable        =   0
  139.       ShowComboButton =   1
  140.       WordWrap        =   -1  'True
  141.       TextStyle       =   0
  142.       TextStyleFixed  =   0
  143.       OleDragMode     =   0
  144.       OleDropMode     =   0
  145.       DataMode        =   0
  146.       VirtualData     =   -1  'True
  147.       DataMember      =   ""
  148.       ComboSearch     =   3
  149.       AutoSizeMouse   =   -1  'True
  150.       FrozenRows      =   0
  151.       FrozenCols      =   0
  152.       AllowUserFreezing=   0
  153.       BackColorFrozen =   0
  154.       ForeColorFrozen =   0
  155.       WallPaperAlignment=   9
  156.       AccessibleName  =   ""
  157.       AccessibleDescription=   ""
  158.       AccessibleValue =   ""
  159.       AccessibleRole  =   24
  160.       Begin VSFlex8Ctl.VSFlexGrid HjGrid 
  161.          Height          =   690
  162.          Left            =   0
  163.          TabIndex        =   12
  164.          Top             =   -2761
  165.          Width           =   8970
  166.          _cx             =   5080
  167.          _cy             =   5080
  168.          Appearance      =   1
  169.          BorderStyle     =   0
  170.          Enabled         =   -1  'True
  171.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  172.             Name            =   "宋体"
  173.             Size            =   9
  174.             Charset         =   134
  175.             Weight          =   400
  176.             Underline       =   0   'False
  177.             Italic          =   0   'False
  178.             Strikethrough   =   0   'False
  179.          EndProperty
  180.          MousePointer    =   0
  181.          BackColor       =   -2147483624
  182.          ForeColor       =   -2147483640
  183.          BackColorFixed  =   -2147483633
  184.          ForeColorFixed  =   -2147483630
  185.          BackColorSel    =   -2147483643
  186.          ForeColorSel    =   -2147483640
  187.          BackColorBkg    =   -2147483636
  188.          BackColorAlternate=   -2147483624
  189.          GridColor       =   -2147483633
  190.          GridColorFixed  =   -2147483632
  191.          TreeColor       =   -2147483632
  192.          FloodColor      =   192
  193.          SheetBorder     =   -2147483642
  194.          FocusRect       =   1
  195.          HighLight       =   0
  196.          AllowSelection  =   0   'False
  197.          AllowBigSelection=   0   'False
  198.          AllowUserResizing=   0
  199.          SelectionMode   =   0
  200.          GridLines       =   1
  201.          GridLinesFixed  =   2
  202.          GridLineWidth   =   1
  203.          Rows            =   5000
  204.          Cols            =   10
  205.          FixedRows       =   0
  206.          FixedCols       =   0
  207.          RowHeightMin    =   0
  208.          RowHeightMax    =   0
  209.          ColWidthMin     =   0
  210.          ColWidthMax     =   0
  211.          ExtendLastCol   =   0   'False
  212.          FormatString    =   ""
  213.          ScrollTrack     =   0   'False
  214.          ScrollBars      =   3
  215.          ScrollTips      =   0   'False
  216.          MergeCells      =   0
  217.          MergeCompare    =   0
  218.          AutoResize      =   -1  'True
  219.          AutoSizeMode    =   0
  220.          AutoSearch      =   0
  221.          AutoSearchDelay =   2
  222.          MultiTotals     =   -1  'True
  223.          SubtotalPosition=   1
  224.          OutlineBar      =   0
  225.          OutlineCol      =   0
  226.          Ellipsis        =   0
  227.          ExplorerBar     =   0
  228.          PicturesOver    =   0   'False
  229.          FillStyle       =   0
  230.          RightToLeft     =   0   'False
  231.          PictureType     =   0
  232.          TabBehavior     =   0
  233.          OwnerDraw       =   0
  234.          Editable        =   0
  235.          ShowComboButton =   1
  236.          WordWrap        =   -1  'True
  237.          TextStyle       =   0
  238.          TextStyleFixed  =   0
  239.          OleDragMode     =   0
  240.          OleDropMode     =   0
  241.          DataMode        =   0
  242.          VirtualData     =   -1  'True
  243.          DataMember      =   ""
  244.          ComboSearch     =   3
  245.          AutoSizeMouse   =   -1  'True
  246.          FrozenRows      =   0
  247.          FrozenCols      =   0
  248.          AllowUserFreezing=   0
  249.          BackColorFrozen =   0
  250.          ForeColorFrozen =   0
  251.          WallPaperAlignment=   9
  252.          AccessibleName  =   ""
  253.          AccessibleDescription=   ""
  254.          AccessibleValue =   ""
  255.          AccessibleRole  =   24
  256.       End
  257.    End
  258.    Begin MSComctlLib.ImageList Imagelist1 
  259.       Left            =   9300
  260.       Top             =   1230
  261.       _ExtentX        =   1005
  262.       _ExtentY        =   1005
  263.       BackColor       =   -2147483643
  264.       ImageWidth      =   16
  265.       ImageHeight     =   16
  266.       MaskColor       =   12632256
  267.       _Version        =   393216
  268.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  269.          NumListImages   =   42
  270.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  271.             Picture         =   "采购系统_采购计划拆分.frx":1756
  272.             Key             =   "sz"
  273.          EndProperty
  274.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  275.             Picture         =   "采购系统_采购计划拆分.frx":1AF0
  276.             Key             =   "dy"
  277.          EndProperty
  278.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  279.             Picture         =   "采购系统_采购计划拆分.frx":1E8A
  280.             Key             =   "yl"
  281.          EndProperty
  282.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  283.             Picture         =   "采购系统_采购计划拆分.frx":2224
  284.             Key             =   "xz"
  285.          EndProperty
  286.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  287.             Picture         =   "采购系统_采购计划拆分.frx":25BE
  288.             Key             =   "xg"
  289.          EndProperty
  290.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  291.             Picture         =   "采购系统_采购计划拆分.frx":2958
  292.             Key             =   "sc"
  293.          EndProperty
  294.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  295.             Picture         =   "采购系统_采购计划拆分.frx":2CF2
  296.             Key             =   "zh"
  297.          EndProperty
  298.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  299.             Picture         =   "采购系统_采购计划拆分.frx":308C
  300.             Key             =   "sh"
  301.          EndProperty
  302.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  303.             Picture         =   "采购系统_采购计划拆分.frx":3426
  304.             Key             =   "bc"
  305.          EndProperty
  306.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  307.             Picture         =   "采购系统_采购计划拆分.frx":37C0
  308.             Key             =   "fq"
  309.          EndProperty
  310.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  311.             Picture         =   "采购系统_采购计划拆分.frx":3B5A
  312.             Key             =   "check"
  313.          EndProperty
  314.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  315.             Picture         =   "采购系统_采购计划拆分.frx":3EF4
  316.             Key             =   "qs"
  317.          EndProperty
  318.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  319.             Picture         =   "采购系统_采购计划拆分.frx":428E
  320.             Key             =   "fullcheck"
  321.          EndProperty
  322.          BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  323.             Picture         =   "采购系统_采购计划拆分.frx":4628
  324.             Key             =   "qq"
  325.          EndProperty
  326.          BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  327.             Picture         =   "采购系统_采购计划拆分.frx":49C2
  328.             Key             =   "first"
  329.          EndProperty
  330.          BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  331.             Picture         =   "采购系统_采购计划拆分.frx":4D5C
  332.             Key             =   "prev"
  333.          EndProperty
  334.          BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  335.             Picture         =   "采购系统_采购计划拆分.frx":50F6
  336.             Key             =   "next"
  337.          EndProperty
  338.          BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  339.             Picture         =   "采购系统_采购计划拆分.frx":5490
  340.             Key             =   "last"
  341.          EndProperty
  342.          BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  343.             Picture         =   "采购系统_采购计划拆分.frx":582A
  344.             Key             =   "bz"
  345.          EndProperty
  346.          BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  347.             Picture         =   "采购系统_采购计划拆分.frx":5BC4
  348.             Key             =   "tc"
  349.          EndProperty
  350.          BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  351.             Picture         =   "采购系统_采购计划拆分.frx":5F5E
  352.             Key             =   "bcgs"
  353.          EndProperty
  354.          BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  355.             Picture         =   "采购系统_采购计划拆分.frx":62F8
  356.             Key             =   "mrlk"
  357.          EndProperty
  358.          BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  359.             Picture         =   "采购系统_采购计划拆分.frx":6692
  360.             Key             =   "xsxm"
  361.          EndProperty
  362.          BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  363.             Picture         =   "采购系统_采购计划拆分.frx":6A2C
  364.             Key             =   "hz"
  365.          EndProperty
  366.          BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  367.             Picture         =   "采购系统_采购计划拆分.frx":6DC6
  368.             Key             =   "dw"
  369.          EndProperty
  370.          BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  371.             Picture         =   "采购系统_采购计划拆分.frx":7160
  372.             Key             =   "zx"
  373.          EndProperty
  374.          BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  375.             Picture         =   "采购系统_采购计划拆分.frx":74FA
  376.             Key             =   "mx"
  377.          EndProperty
  378.          BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  379.             Picture         =   "采购系统_采购计划拆分.frx":7894
  380.             Key             =   "hf"
  381.          EndProperty
  382.          BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  383.             Picture         =   "采购系统_采购计划拆分.frx":7C2E
  384.             Key             =   "cx"
  385.          EndProperty
  386.          BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  387.             Picture         =   "采购系统_采购计划拆分.frx":7FC8
  388.             Key             =   "sx"
  389.          EndProperty
  390.          BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  391.             Picture         =   "采购系统_采购计划拆分.frx":8362
  392.             Key             =   "dj"
  393.          EndProperty
  394.          BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  395.             Picture         =   "采购系统_采购计划拆分.frx":86FC
  396.             Key             =   "tb"
  397.          EndProperty
  398.          BeginProperty ListImage33 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  399.             Picture         =   "采购系统_采购计划拆分.frx":8A96
  400.             Key             =   "px"
  401.          EndProperty
  402.          BeginProperty ListImage34 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  403.             Picture         =   "采购系统_采购计划拆分.frx":8E30
  404.             Key             =   "zq"
  405.          EndProperty
  406.          BeginProperty ListImage35 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  407.             Picture         =   "采购系统_采购计划拆分.frx":91CA
  408.             Key             =   "wc"
  409.          EndProperty
  410.          BeginProperty ListImage36 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  411.             Picture         =   "采购系统_采购计划拆分.frx":9564
  412.             Key             =   "ye"
  413.          EndProperty
  414.          BeginProperty ListImage37 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  415.             Picture         =   "采购系统_采购计划拆分.frx":98FE
  416.             Key             =   "zz"
  417.          EndProperty
  418.          BeginProperty ListImage38 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  419.             Picture         =   "采购系统_采购计划拆分.frx":9C98
  420.             Key             =   "jz"
  421.          EndProperty
  422.          BeginProperty ListImage39 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  423.             Picture         =   "采购系统_采购计划拆分.frx":A032
  424.             Key             =   "xx"
  425.          EndProperty
  426.          BeginProperty ListImage40 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  427.             Picture         =   "采购系统_采购计划拆分.frx":A3CC
  428.             Key             =   "ph"
  429.          EndProperty
  430.          BeginProperty ListImage41 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  431.             Picture         =   "采购系统_采购计划拆分.frx":A766
  432.             Key             =   "dz"
  433.          EndProperty
  434.          BeginProperty ListImage42 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  435.             Picture         =   "采购系统_采购计划拆分.frx":AB00
  436.             Key             =   "cf"
  437.          EndProperty
  438.       EndProperty
  439.    End
  440.    Begin MSComctlLib.Toolbar Tlb_Action 
  441.       Align           =   1  'Align Top
  442.       Height          =   555
  443.       Left            =   0
  444.       TabIndex        =   10
  445.       Top             =   0
  446.       Width           =   9915
  447.       _ExtentX        =   17489
  448.       _ExtentY        =   979
  449.       ButtonWidth     =   820
  450.       ButtonHeight    =   926
  451.       AllowCustomize  =   0   'False
  452.       Appearance      =   1
  453.       Style           =   1
  454.       ImageList       =   "Imagelist1"
  455.       _Version        =   393216
  456.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  457.          NumButtons      =   34
  458.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  459.             Caption         =   "设置"
  460.             Key             =   "ymsz"
  461.             Object.ToolTipText     =   "打印页面设置"
  462.             ImageKey        =   "sz"
  463.          EndProperty
  464.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  465.             Caption         =   "打印"
  466.             Key             =   "dy"
  467.             ImageKey        =   "dy"
  468.          EndProperty
  469.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  470.             Caption         =   "预览"
  471.             Key             =   "yl"
  472.             ImageKey        =   "yl"
  473.          EndProperty
  474.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  475.             Key             =   "bKey1"
  476.             Style           =   3
  477.          EndProperty
  478.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  479.             Object.Visible         =   0   'False
  480.             Caption         =   "新增"
  481.             Key             =   "xz"
  482.             Object.ToolTipText     =   "新增加一张单据或F5"
  483.          EndProperty
  484.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  485.             Object.Visible         =   0   'False
  486.             Caption         =   "修改"
  487.             Key             =   "xg"
  488.             Object.ToolTipText     =   "修改当前单据"
  489.          EndProperty
  490.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  491.             Object.Visible         =   0   'False
  492.             Caption         =   "删除"
  493.             Key             =   "sc"
  494.             Object.ToolTipText     =   "删除当前单据"
  495.          EndProperty
  496.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  497.             Object.Visible         =   0   'False
  498.             Key             =   "bKey2"
  499.             Style           =   3
  500.          EndProperty
  501.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  502.             Enabled         =   0   'False
  503.             Caption         =   "增行"
  504.             Key             =   "zh"
  505.             Object.ToolTipText     =   "插入一行"
  506.             ImageKey        =   "zh"
  507.          EndProperty
  508.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  509.             Enabled         =   0   'False
  510.             Caption         =   "删行"
  511.             Key             =   "sh"
  512.             Object.ToolTipText     =   "删除当前记录行"
  513.             ImageKey        =   "sh"
  514.          EndProperty
  515.          BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  516.             Key             =   "bKey3"
  517.             Style           =   3
  518.          EndProperty
  519.          BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  520.             Enabled         =   0   'False
  521.             Caption         =   "保存"
  522.             Key             =   "bc"
  523.             Object.ToolTipText     =   "保存单据"
  524.             ImageKey        =   "bc"
  525.          EndProperty
  526.          BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  527.             Enabled         =   0   'False
  528.             Object.Visible         =   0   'False
  529.             Caption         =   "放弃"
  530.             Key             =   "fq"
  531.             Object.ToolTipText     =   "放弃此次操作"
  532.             ImageKey        =   "fq"
  533.          EndProperty
  534.          BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  535.             Object.Visible         =   0   'False
  536.             Key             =   "bKey4"
  537.             Style           =   3
  538.          EndProperty
  539.          BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  540.             Object.Visible         =   0   'False
  541.             Caption         =   "查询"
  542.             Key             =   "cx"
  543.          EndProperty
  544.          BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  545.             Object.Visible         =   0   'False
  546.             Key             =   "bKey5"
  547.             Style           =   3
  548.          EndProperty
  549.          BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  550.             Object.Visible         =   0   'False
  551.             Caption         =   "审核"
  552.             Key             =   "Check"
  553.             Object.ToolTipText     =   "查询科目最新余额"
  554.          EndProperty
  555.          BeginProperty Button18 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  556.             Object.Visible         =   0   'False
  557.             Caption         =   "弃审"
  558.             Key             =   "Uncheck"
  559.             Object.ToolTipText     =   "填制凭证选项"
  560.          EndProperty
  561.          BeginProperty Button19 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  562.             Object.Visible         =   0   'False
  563.             Caption         =   "全审"
  564.             Key             =   "CheckAll"
  565.          EndProperty
  566.          BeginProperty Button20 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  567.             Object.Visible         =   0   'False
  568.             Caption         =   "全弃"
  569.             Key             =   "UncheckAll"
  570.          EndProperty
  571.          BeginProperty Button21 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  572.             Object.Visible         =   0   'False
  573.             Key             =   "sCheck"
  574.             Style           =   3
  575.          EndProperty
  576.          BeginProperty Button22 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  577.             Object.Visible         =   0   'False
  578.             Caption         =   "执行"
  579.             Key             =   "Exec"
  580.          EndProperty
  581.          BeginProperty Button23 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  582.             Object.Visible         =   0   'False
  583.             Caption         =   "弃执"
  584.             Key             =   "Unexec"
  585.          EndProperty
  586.          BeginProperty Button24 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  587.             Object.Visible         =   0   'False
  588.             Caption         =   "全执"
  589.             Key             =   "ExecAll"
  590.          EndProperty
  591.          BeginProperty Button25 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  592.             Object.Visible         =   0   'False
  593.             Caption         =   "全弃"
  594.             Key             =   "UnexecAll"
  595.          EndProperty
  596.          BeginProperty Button26 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  597.             Object.Visible         =   0   'False
  598.             Key             =   "sExec"
  599.             Style           =   3
  600.          EndProperty
  601.          BeginProperty Button27 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  602.             Object.Visible         =   0   'False
  603.             Key             =   "fgh"
  604.             Style           =   3
  605.          EndProperty
  606.          BeginProperty Button28 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  607.             Object.Visible         =   0   'False
  608.             Caption         =   "首张"
  609.             Key             =   "first"
  610.          EndProperty
  611.          BeginProperty Button29 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  612.             Object.Visible         =   0   'False
  613.             Caption         =   "上张"
  614.             Key             =   "prev"
  615.          EndProperty
  616.          BeginProperty Button30 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  617.             Object.Visible         =   0   'False
  618.             Caption         =   "下张"
  619.             Key             =   "next"
  620.          EndProperty
  621.          BeginProperty Button31 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  622.             Object.Visible         =   0   'False
  623.             Caption         =   "末张"
  624.             Key             =   "last"
  625.          EndProperty
  626.          BeginProperty Button32 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  627.             Key             =   "bKey6"
  628.             Style           =   3
  629.          EndProperty
  630.          BeginProperty Button33 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  631.             Object.Visible         =   0   'False
  632.             Caption         =   "帮助"
  633.             Key             =   "bz"
  634.             ImageKey        =   "bz"
  635.          EndProperty
  636.          BeginProperty Button34 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  637.             Caption         =   "退出"
  638.             Key             =   "fh"
  639.             ImageKey        =   "tc"
  640.          EndProperty
  641.       EndProperty
  642.       BorderStyle     =   1
  643.    End
  644.    Begin VB.Label Lab_MakeBill 
  645.       Appearance      =   0  'Flat
  646.       BackColor       =   &H80000005&
  647.       BackStyle       =   0  'Transparent
  648.       ForeColor       =   &H80000008&
  649.       Height          =   285
  650.       Left            =   780
  651.       TabIndex        =   8
  652.       Top             =   6240
  653.       Width           =   960
  654.    End
  655.    Begin VB.Label TsLabel 
  656.       AutoSize        =   -1  'True
  657.       BackStyle       =   0  'Transparent
  658.       Caption         =   "审核:"
  659.       Height          =   195
  660.       Index           =   0
  661.       Left            =   4917
  662.       TabIndex        =   7
  663.       Top             =   7457
  664.       Width           =   540
  665.    End
  666.    Begin VB.Label TsLabel 
  667.       AutoSize        =   -1  'True
  668.       BackStyle       =   0  'Transparent
  669.       Caption         =   "制单:"
  670.       Height          =   180
  671.       Index           =   8
  672.       Left            =   180
  673.       TabIndex        =   6
  674.       Top             =   6240
  675.       Width           =   450
  676.    End
  677.    Begin VB.Label TsLabel 
  678.       AutoSize        =   -1  'True
  679.       BackColor       =   &H80000018&
  680.       BackStyle       =   0  'Transparent
  681.       Caption         =   "采购计划拆分"
  682.       BeginProperty Font 
  683.          Name            =   "宋体"
  684.          Size            =   14.25
  685.          Charset         =   134
  686.          Weight          =   700
  687.          Underline       =   0   'False
  688.          Italic          =   0   'False
  689.          Strikethrough   =   0   'False
  690.       EndProperty
  691.       ForeColor       =   &H00000000&
  692.       Height          =   285
  693.       Index           =   4
  694.       Left            =   4020
  695.       TabIndex        =   5
  696.       Top             =   960
  697.       Width           =   1800
  698.    End
  699.    Begin VB.Label Lab_Pzclzt 
  700.       BackColor       =   &H80000018&
  701.       Caption         =   "1"
  702.       ForeColor       =   &H00808080&
  703.       Height          =   255
  704.       Left            =   9240
  705.       TabIndex        =   4
  706.       Top             =   990
  707.       Visible         =   0   'False
  708.       Width           =   285
  709.    End
  710.    Begin VB.Label Lab_OperStatus 
  711.       BackColor       =   &H000080FF&
  712.       Caption         =   "1"
  713.       Height          =   345
  714.       Left            =   9180
  715.       TabIndex        =   3
  716.       Top             =   570
  717.       Visible         =   0   'False
  718.       Width           =   345
  719.    End
  720. End
  721. Attribute VB_Name = "Cg_FrmPlanSplit"
  722. Attribute VB_GlobalNameSpace = False
  723. Attribute VB_Creatable = False
  724. Attribute VB_PredeclaredId = True
  725. Attribute VB_Exposed = False
  726. '*********************************************************************************************************
  727. '*    模 块 名 称 :采购计划拆分
  728. '*    功 能 描 述 :此功能模块主要完成采购计划的拆分。
  729. '*    程序员姓名  : 李海祥
  730. '*    最后修改人  : 李海祥
  731. '*    最后修改时间:2001/07/19
  732. '*    备        注:程序中所有依实际情况自定义部分均用[>>  <<]括起
  733. '*
  734. '*    1.每次调入外部功能窗体,均要加锁ChangeLock=True,窗体关闭后解锁ChangeLock=false
  735. '*
  736. '*    2.网格列存储内容注解
  737. '*
  738. '*    3.Lab_OperStatus 用此标签来标识单据录入状态(默认值为1) "1"-浏览 "2"-新增 "3"-修改 "4"-删除
  739. '*
  740. '*    4.原则:只要单据能够存盘(无论修改或新增)则其必须接受完整性及有效性规则检查
  741. '*
  742. '*********************************************************************************************************
  743.     '[以下为根据实际情况设置变量
  744.     Dim Tsxx As String
  745.     Dim int_FrmState As Integer                    '表示为窗体的状态 1、新增 2、维护 3、查询
  746.     Public dbl_RecordAutoCode As Double                   '当前编辑计划纪录的记录号
  747.     Public bln_Help As Boolean
  748.     Public rs_PlanSearch As New ADODB.Recordset     '满足条件的记录集
  749.     Public rs_PAutoID As New ADODB.Recordset
  750.     Public bln_IsChanged As Boolean
  751.     Dim Material_Num() As Double                     '拆分前物料总数量
  752.     Dim Material_Str() As String
  753.     Dim Lng_KjYear As Long
  754.     Dim Lng_Period As Long
  755.     Public plan_material_num As Long
  756.     Dim arrDbl_Quan() As Double
  757.   
  758.     Dim arrStr_MNum() As String
  759.     Dim arrStr_LeftMNum() As String
  760.     Dim arrDbl_LeftQuan() As Double
  761.     Dim arrStr_PackType() As String
  762.     Dim arrStr_TrafficMode() As String
  763.     Dim arrStr_Execer() As String
  764.     Dim rs_From(1) As New ADODB.Recordset
  765.   
  766.  '**************************bfy]
  767.  
  768.  '以下为固定使用变量(网格)
  769.     Dim Cxnrrec As New ADODB.Recordset              '显示查询内容动态集
  770.     Dim Dyymctbl As New DY_Dyymsz                   '打印页面窗体变量
  771.     Dim GridCode As String                          '显示网格网格代码
  772.     Dim GridInf() As Variant                        '整个网格设置信息
  773.     Dim ReportTitle As String                       '报表主标题
  774.     Dim Pmbcsjhs As Long                            '屏幕网格保持数据行数(大于等于1)
  775.     Dim Fzxwghs As Integer                          '辅助项网格行数(包括合计行)
  776.     Dim Sfxshjwg As Boolean                         '是否显示合计网格
  777.     Dim Qslz As Long                                '网格隐藏(非操作显示)列数
  778.     Dim Sjhgd As Double                             '网格数据行高度
  779.     Dim GridBoolean() As Boolean                    '网格列信息(布尔型)
  780.     Dim GridStr()  As String                        '网格列信息(字符型)
  781.     Dim GridInt() As Integer                        '网格列信息(整型)
  782.     Dim Sfblbzkd As Boolean                         '是否保留帮助宽度(字段提供帮助时,是否为按钮保留空间)
  783.     Dim Dqlrwgh As Long                             '当前录入数据网格行
  784.     Dim Dqlrwgl As Long                             '当前录入数据网格列
  785.     Dim Dqlkwgh As Long                             '刚刚离开网格行(不一定为录入行)
  786.     Dim Dqlkwgl As Long                             '刚刚离开网格列
  787.     Dim Dqtoprow As Long                            '当前录入状态时最上端可视行
  788.     Dim Dqleftcol As Long                           '当前录入状态时最左端可视列
  789.     Dim Zdlrqnr As String                           '字段录入修改前内容(用来判断内容是否修改)
  790.     Dim Wbkbhlock As Boolean                        '文本框改变值锁
  791.     Dim Changelock As Boolean                       '网格行列改变控制锁(用来区别用户改变.程序改变)
  792.     Dim Gdtlock As Boolean                          '滚动条滚动控制(用来区别用户改变.程序改变)
  793.     Dim Yxxpdlock As Boolean                        '字段有效性判断锁(内容不修改不需进行字段有效性判断)
  794.     Dim Hyxxpdlock As Boolean                       '行有效性判断锁(字段内容不修改不需进行行有效性判断)
  795.     Dim Valilock As Boolean                         '文本框失去焦点是否进行有效性控制(TRUE 为锁定*限用网格录入)
  796.     Dim Shsfts As Boolean                           '删除记录行是否提示
  797.     Dim Szzls As Integer                            '网格信息数组最大下标值(网格列数-1)
  798.     
  799.  '以下为固定使用变量(文本框)
  800.     Dim Textvar() As Variant                        '存储变体型文本框信息
  801.     Dim Textboolean() As Boolean                    '存储布尔型文本框信息
  802.     Dim Textint() As Integer                        '存储整型文本框信息
  803.     Dim Textstr() As String                         '存储字符型文本框信息
  804.     Dim Max_Text_Index As Integer                   '最大录入文本框索引值
  805.     Dim TextGroupCode As String                     '文本框录入分组编码
  806.     Dim TextValiLock As Boolean                     '文本框失去焦点是否进行有效性控制判断
  807.     Dim TextValiJudgeLock() As Boolean              '文本框录入有效性判断控制锁
  808.     Dim TextChangeLock As Boolean                   '文本框内容变换控制锁
  809.     Dim Bln_Cancel As Boolean                       '取消按钮信息传递
  810. Private Function FnBln_SaveData(int_OperStatus As Integer) As Boolean
  811.   
  812.     
  813.     FnBln_SaveData = True
  814.     Dim i As Long
  815.     Dim Lng_Jsq As Long
  816.     Dim str_SQlSave  As String
  817.     Dim rs_Save(1) As New ADODB.Recordset     ' 保存记录集
  818.     Dim Int_Year As Integer
  819.     Dim Int_Period As Integer
  820.     Dim str_SQLAssi As String
  821.     Dim rs_SQLAssi As New ADODB.Recordset
  822.     Dim str_Insert As String
  823.     Dim rs_Temp As New ADODB.Recordset
  824.     Dim Lng_Cfpc As Long                       '同次拆分过程号
  825.     Dim Rs_Plan As New ADODB.Recordset         '有生产厂家的记录单独保存
  826.     Dim Rs_Plan1 As New ADODB.Recordset
  827.     Cw_DataEnvi.DataConnect.BeginTrans
  828.     '保存拆分数量
  829. On Error GoTo error_manager
  830.     Set rs_Temp = Cw_DataEnvi.DataConnect.Execute(" select Max(SplitUniteNum) as MSplitUniteNum from Cg_PurPlanMain")
  831.     Lng_Cfpc = rs_Temp.Fields("MSplitUniteNum") + 1
  832.     Set rs_Temp = Nothing
  833.     For i = Me.WglrGrid.FixedRows To Me.WglrGrid.Rows - 1
  834.         If Me.WglrGrid.TextMatrix(i, 0) = "*" Then
  835.             '保存主表
  836.             str_SQlSave = "select * from Cg_PurPlanMain where 1=2"
  837.             If rs_Save(0).State = 1 Then rs_Save(0).Close
  838.             rs_Save(0).Open str_SQlSave, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockPessimistic
  839.             With rs_Save(0)
  840.                 .AddNew
  841.                 .Fields("PurPlanNum") = CreatBillCode("1101", True)                 '计划单号
  842.                 .Fields("KjYear") = Lng_KjYear                                      '会计年度
  843.                 .Fields("Period") = Lng_Period                                      '会计月份
  844.                 .Fields("PurPlanDate") = Format(Xtrq, "yyyy-mm-dd")                 '计划日期
  845.                 .Fields("PurPlanType") = "拆分生成"                                 '计划类型
  846.                 .Fields("DeptCode") = rs_From(0).Fields("DeptCode")                 '计划部门
  847.                 .Fields("PersonCode") = rs_From(0).Fields("PersonCode")             '计划人
  848.                 .Fields("ExigenceFlag") = rs_From(0).Fields("ExigenceFlag")         '紧急标志
  849.                 If Trim(Me.WglrGrid.TextMatrix(i, 1)) <> "" Then
  850.                     .Fields("SupplierCode") = Trim(Me.WglrGrid.TextMatrix(i, 1))    '供应商
  851.                 End If
  852.                 .Fields("Maker") = Xtczy                                            '制单人
  853.                 .Fields("Checker") = Xtczy                                          '审核人
  854.                 .Fields("Remark") = Trim(rs_From(0).Fields("Remark") & "")          '备注
  855.                 .Fields("Transmitter") = ""                                         '下达人置空
  856.                 .Fields("FinishFlag") = 0                                           '完成标志
  857.                 .Fields("SplitUniteFlag") = 0                                       '拆合标志
  858.                 .Fields("PurPlanStyle") = "2"                                       '不能被生产系统调用
  859.                 .Fields("PurPlanMainID") = CreatBillID("1101")                      '单据ID
  860.                 .Fields("SplitUniteNum") = Lng_Cfpc                                 '拆分合并过程号
  861.                 .UpdateBatch
  862.           
  863.             End With
  864.             '保存从表
  865.             str_SQlSave = "select * from Cg_PurPlanSub where 1=2"
  866.             If rs_Save(1).State = 1 Then rs_Save(1).Close
  867.             rs_Save(1).Open str_SQlSave, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockPessimistic
  868.             
  869.             With rs_Save(1)
  870.                 .AddNew
  871.                 .Fields("PurPlanMainID") = rs_Save(0).Fields("PurPlanMainID") + 0                       '单据ID
  872.                 .Fields("MNumber") = Trim(Me.WglrGrid.TextMatrix(i, Sydz("001", GridStr(), Szzls)))     '物料编码
  873.                 .Fields("Quantity") = S2N(Me.WglrGrid.TextMatrix(i, Sydz("006", GridStr(), Szzls)))     '数量
  874.                 .Fields("Buyer") = ""                                                                   '采购员
  875.                 .Fields("PurPlanSubID") = 1                                                             '子表ID
  876.                 .Fields("ProcFactory") = ""                                                             '生产厂家
  877.                 .UpdateBatch
  878.                 str_Insert = "insert into Cg_SplitUnite(SplitUniteNum,NewPurPlanMainID,NewPurPlanSubID,PurPlanMainID,PurPlanSubID)" & "values( " & Lng_Cfpc & "," & rs_Save(0).Fields("PurPlanMainID") & " ," & rs_Save(1).Fields("PurPlanSubID") & "," & rs_From(0).Fields("PurPlanMainID") & ",1)"
  879.                 Cw_DataEnvi.DataConnect.Execute (str_Insert)
  880.             End With
  881.         End If
  882.     Next i
  883.     
  884.     ' 保存剩余单据
  885.     Dim Is_Left As Boolean
  886.     Is_Left = False
  887.     For i = LBound(arrStr_LeftMNum, 1) To UBound(arrStr_LeftMNum, 1)
  888.         If arrDbl_LeftQuan(i) <> 0 Then
  889.             Is_Left = True
  890.             Exit For
  891.         End If
  892.     Next i
  893.     If Is_Left Then
  894.         str_SQlSave = "select * from Cg_PurPlanMain where 1=2"
  895.         If rs_Save(0).State = 1 Then rs_Save(0).Close
  896.         rs_Save(0).Open str_SQlSave, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockPessimistic
  897.         With rs_Save(0)
  898.             .AddNew
  899.             .Fields("PurPlanNum") = CreatBillCode("1101", True)         '单据号
  900.             .Fields("KjYear") = Lng_KjYear                              '会计年度
  901.             .Fields("Period") = Lng_Period                              '会计月份
  902.             .Fields("PurPlanDate") = Format(Xtrq, "yyyy-mm-dd")         '计划日期
  903.             .Fields("PurPlanType") = "拆分生成"                         '计划类型
  904.             .Fields("DeptCode") = rs_From(0).Fields("DeptCode")         '计划部门
  905.             .Fields("PersonCode") = rs_From(0).Fields("PersonCode")     '计划人
  906.             .Fields("ExigenceFlag") = rs_From(0).Fields("ExigenceFlag") '紧急标志
  907.             .Fields("SupplierCode") = rs_From(0).Fields("SupplierCode") '供应商
  908.             .Fields("Maker") = Xtczy                                    '制单人
  909.             .Fields("Checker") = Xtczy                                  '审核人
  910.             .Fields("Remark") = Trim(rs_From(0).Fields("Remark") & "")  '备注
  911.             .Fields("Transmitter") = ""                                 '下达人置空
  912.             .Fields("FinishFlag") = 0                                   '完成标志
  913.             .Fields("SplitUniteFlag") = 0                               '拆合标志
  914.             .Fields("PurPlanStyle") = "2"                               '不能被生产系统调用
  915.             .Fields("PurPlanMainID") = CreatBillID("1101")              '单据ID
  916.             .Fields("SplitUniteNum") = Lng_Cfpc                         '拆分合并过程号
  917.             .UpdateBatch
  918.         End With
  919.         '保存从表
  920.         Lng_Jsq = 1
  921.         For i = LBound(arrStr_LeftMNum, 1) To UBound(arrStr_LeftMNum, 1)
  922.             If arrDbl_LeftQuan(i) <> 0 Then
  923.                 str_SQlSave = "select * from Cg_PurPlanSub where 1=2"
  924.                 If rs_Save(1).State = 1 Then rs_Save(1).Close
  925.                 rs_Save(1).Open str_SQlSave, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockPessimistic
  926.                 With rs_Save(1)
  927.                     .AddNew
  928.                     .Fields("PurPlanMainID") = rs_Save(0).Fields("PurPlanMainID") + 0   '单据ID
  929.                     .Fields("MNumber") = arrStr_LeftMNum(i)                             '物料编码
  930.                     .Fields("Quantity") = arrDbl_LeftQuan(i)                            '数量
  931.                     .Fields("Buyer") = ""                                               '采购员
  932.                     .Fields("ProcFactory") = ""                                         '生产厂家
  933.                     .Fields("PurPlanSubID") = Lng_Jsq                                   '子表ID
  934.                     .UpdateBatch
  935.                     str_Insert = "insert into Cg_SplitUnite(SplitUniteNum,NewPurPlanMainID,NewPurPlanSubID,PurPlanMainID,PurPlanSubID)" & "values( " & Lng_Cfpc & "," & rs_Save(0).Fields("PurPlanMainID") & " ," & rs_Save(1).Fields("PurPlanSubID") & "," & rs_From(0).Fields("PurPlanMainID") & "," & Lng_Jsq & ")"
  936.                     Cw_DataEnvi.DataConnect.Execute (str_Insert)
  937.                 End With
  938.                 Lng_Jsq = Lng_Jsq + 1
  939.             End If
  940.         Next i
  941.         '保存有生产厂家的记录
  942.         Set Rs_Plan = Cw_DataEnvi.DataConnect.Execute("Select * from Cg_V_PlanBill where PurPlanMainID='" & Me.dbl_RecordAutoCode & "' and ProcFactory<>'' ")
  943.         Do While Not Rs_Plan.EOF()
  944.             str_SQlSave = "select * from Cg_PurPlanSub where 1=2"
  945.             If rs_Save(1).State = 1 Then rs_Save(1).Close
  946.             rs_Save(1).Open str_SQlSave, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockPessimistic
  947.             With rs_Save(1)
  948.                 .AddNew
  949.                 .Fields("PurPlanMainID") = rs_Save(0).Fields("PurPlanMainID") + 0   '单据ID
  950.                 .Fields("MNumber") = Rs_Plan.Fields("MNumber")                      '物料编码
  951.                 .Fields("Quantity") = Rs_Plan.Fields("Quantity")                    '数量
  952.                 .Fields("Buyer") = ""                                               '采购员
  953.                 .Fields("PurPlanSubID") = Lng_Jsq                                   '子表ID
  954.                 .Fields("ProcFactory") = Rs_Plan.Fields("ProcFactory")              '生产厂家
  955.                 .UpdateBatch
  956.                 str_Insert = "insert into Cg_SplitUnite(SplitUniteNum,NewPurPlanMainID,NewPurPlanSubID,PurPlanMainID,PurPlanSubID)" & "values( " & Lng_Cfpc & "," & rs_Save(0).Fields("PurPlanMainID") & " ," & Lng_Jsq & "," & rs_From(0).Fields("PurPlanMainID") & "," & Rs_Plan.Fields("PurPlanSubID") & " )"
  957.                 Cw_DataEnvi.DataConnect.Execute (str_Insert)
  958.             End With
  959.             Rs_Plan.MoveNext
  960.             Lng_Jsq = Lng_Jsq + 1
  961.         Loop
  962.     Else
  963.     
  964.         '保存有生产厂家的记录
  965.         Set Rs_Plan1 = Cw_DataEnvi.DataConnect.Execute("Select * from Cg_V_PlanBill where PurPlanMainID='" & Me.dbl_RecordAutoCode & "' and ProcFactory<>'' ")
  966.         If Not Rs_Plan1.EOF Then
  967.             str_SQlSave = "select * from Cg_PurPlanMain where 1=2"
  968.             If rs_Save(0).State = 1 Then rs_Save(0).Close
  969.             rs_Save(0).Open str_SQlSave, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockPessimistic
  970.             With rs_Save(0)
  971.                 .AddNew
  972.                 .Fields("PurPlanNum") = CreatBillCode("1101", True)             '单据号
  973.                 .Fields("KjYear") = Lng_KjYear                                  '会计年度
  974.                 .Fields("Period") = Lng_Period                                  '会计月份
  975.                 .Fields("PurPlanDate") = Format(Xtrq, "yyyy-mm-dd")             '计划日期
  976.                 .Fields("PurPlanType") = "拆分生成"                             '计划类型
  977.                 .Fields("DeptCode") = rs_From(0).Fields("DeptCode")             '计划部门
  978.                 .Fields("PersonCode") = rs_From(0).Fields("PersonCode")         '计划人
  979.                 .Fields("ExigenceFlag") = rs_From(0).Fields("ExigenceFlag")     '紧急标志
  980.                 .Fields("SupplierCode") = rs_From(0).Fields("SupplierCode")     '供应商
  981.                 .Fields("Maker") = Xtczy                                        '制单人
  982.                 .Fields("Checker") = Xtczy                                      '审核人
  983.                 .Fields("Remark") = Trim(rs_From(0).Fields("Remark") & "")      '备注
  984.                 .Fields("PurPlanStyle") = "2"                                   '不能被生产系统调用
  985.                 .Fields("Transmitter") = ""                                     '下达人置空
  986.                 .Fields("FinishFlag") = 0                                       '完成标志
  987.                 .Fields("SplitUniteFlag") = 0                                   '拆合标志
  988.                 .Fields("PurPlanMainID") = CreatBillID("1101")                  '单据ID
  989.                 .Fields("SplitUniteNum") = Lng_Cfpc                             '拆分合并过程号
  990.                 .UpdateBatch
  991.             End With
  992.             '保存从表
  993.             Set Rs_Plan = Cw_DataEnvi.DataConnect.Execute("Select * from Cg_V_PlanBill where PurPlanMainID='" & Me.dbl_RecordAutoCode & "' and ProcFactory<>'' ")
  994.             Lng_Jsq = 1
  995.             Do While Not Rs_Plan.EOF()
  996.                 str_SQlSave = "select * from Cg_PurPlanSub where 1=2"
  997.                 If rs_Save(1).State = 1 Then rs_Save(1).Close
  998.                 rs_Save(1).Open str_SQlSave, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockPessimistic
  999.                 With rs_Save(1)
  1000.                     .AddNew
  1001.                     .Fields("PurPlanMainID") = rs_Save(0).Fields("PurPlanMainID") + 0   '单据ID
  1002.                     .Fields("MNumber") = Rs_Plan.Fields("MNumber")                      '物料编码
  1003.                     .Fields("Quantity") = Rs_Plan.Fields("Quantity")                    '数量
  1004.                     .Fields("Buyer") = ""                                               '采购员
  1005.                     .Fields("PurPlanSubID") = Lng_Jsq                                   '子表ID
  1006.                     .Fields("ProcFactory") = Rs_Plan.Fields("ProcFactory")              '生产厂家
  1007.                     .UpdateBatch
  1008.                     str_Insert = "insert into Cg_SplitUnite(SplitUniteNum,NewPurPlanMainID,NewPurPlanSubID,PurPlanMainID,PurPlanSubID)" & "values( " & Lng_Cfpc & "," & rs_Save(0).Fields("PurPlanMainID") & " ," & Lng_Jsq & "," & rs_From(0).Fields("PurPlanMainID") & "," & Rs_Plan.Fields("PurPlanSubID") & " )"
  1009.                     Cw_DataEnvi.DataConnect.Execute (str_Insert)
  1010.                 End With
  1011.                 Rs_Plan.MoveNext
  1012.                 Lng_Jsq = Lng_Jsq + 1
  1013.             Loop
  1014.         End If
  1015.     End If
  1016.     '隐藏原始单据
  1017.     Str_Temp = "select * from Cg_PurPlanMain where PurPlanMainID='" & Me.dbl_RecordAutoCode & "' and Checker=''"
  1018.     Set rs_Temp = Cw_DataEnvi.DataConnect.Execute(Str_Temp)
  1019.     If Not rs_Temp.EOF() Then
  1020.         Call Xtxxts("该计划已经被其他人弃审,不能拆分!", 0, 1)
  1021.         Cw_DataEnvi.DataConnect.RollbackTrans
  1022.         FnBln_SaveData = False
  1023.         Exit Function
  1024.     End If
  1025.     Set rs_Temp = Nothing
  1026.     Str_Temp = "select * from Cg_PurPlanMain where PurPlanMainID='" & Me.dbl_RecordAutoCode & "' and Transmitter<>''"
  1027.     Set rs_Temp = Cw_DataEnvi.DataConnect.Execute(Str_Temp)
  1028.     If Not rs_Temp.EOF() Then
  1029.         Call Xtxxts("该计划已经被其他人下达,不能拆分!", 0, 1)
  1030.         Cw_DataEnvi.DataConnect.RollbackTrans
  1031.         FnBln_SaveData = False
  1032.         Exit Function
  1033.     End If
  1034.     Set rs_Temp = Nothing
  1035.     Str_Temp = "update Cg_PurPlanMain set SplitUniteFlag=2 where PurPlanMainID='" & Me.dbl_RecordAutoCode & "'"
  1036.     Cw_DataEnvi.DataConnect.Execute (Str_Temp)
  1037.     Cw_DataEnvi.DataConnect.CommitTrans
  1038.     Exit Function
  1039.     Xtfhcs = "1"
  1040. error_manager:
  1041.     Cw_DataEnvi.DataConnect.RollbackTrans
  1042.     Tsxx = "系统生成出现错误,系统恢复到原来状态!"
  1043.     Call Xtxxts(Tsxx, 0, 1)
  1044.     FnBln_SaveData = False
  1045. End Function
  1046. Private Sub Form_KeyPress(KeyAscii As Integer)       '控 制 焦 点 转 移
  1047.     Select Case KeyAscii
  1048.         Case 39           '屏蔽字符"'"
  1049.         KeyAscii = 0
  1050.     End Select
  1051. End Sub
  1052. Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
  1053.     If Shift = 2 Then
  1054.         With Me.Tlb_Action
  1055.             Select Case KeyCode
  1056.                 Case vbKeyP
  1057.                     If .Buttons("dy").Enabled = True And .Buttons("dy").Visible = True Then
  1058.                         Call Tlb_Action_ButtonClick(.Buttons("dy"))
  1059.                     End If
  1060.             End Select
  1061.         End With
  1062.     End If
  1063. End Sub
  1064. Private Sub Form_Load()                              '窗 体 装 入
  1065.     Xtrq = Format(Xtrq, "yyyy-mm-dd")
  1066.   
  1067.     '初始化各种锁值
  1068.     
  1069.     Changelock = False             '网格行列改变控制锁
  1070.     Gdtlock = False                '滚动条滚动控制
  1071.     Yxxpdlock = True               '字段有效性判断锁
  1072.     Hyxxpdlock = True              '行有效性判断锁
  1073.     Wbkbhlock = False              '文本框内容改变锁
  1074.    
  1075.   
  1076.     '报表主标题及报表编码
  1077.     
  1078.     ReportTitle = "采购计划拆分"
  1079.     XtReportCode = "Cg_PlanSplit"
  1080.     Load Dyymctbl
  1081.   
  1082.     '调 入 网 格
  1083.     GridCode = "Cg_PlanSplit"          '网格属性编码
  1084.     Call BzWgcsh(WglrGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  1085.   
  1086.     Qslz = GridInf(1)
  1087.     Sjhgd = GridInf(2)
  1088.     Pmbcsjhs = GridInf(3)
  1089.     Fzxwghs = GridInf(4)
  1090.     Sfblbzkd = GridInf(5)
  1091.     Shsfts = GridInf(6)
  1092.     Sfxshjwg = GridInf(7)
  1093.     Szzls = WglrGrid.Cols - 1
  1094.   
  1095.     bln_IsChanged = False
  1096.     Xtfhcs = "0"
  1097.     With WglrGrid
  1098.         .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  1099.         For jsqte = .FixedRows To .Rows - 1
  1100.             .RowHeight(jsqte) = Sjhgd
  1101.         Next jsqte
  1102.   
  1103.         .Clear 1
  1104.         Changelock = True
  1105.         .Select .FixedRows, Qslz
  1106.         Changelock = False
  1107.     For i = 0 To .Cols - 1
  1108.         If i = Sydz("006", GridStr(), Szzls) Then
  1109.             .ColAlignment(i) = flexAlignRightTop
  1110.         Else
  1111.             .ColAlignment(i) = flexAlignCenterCenter
  1112.         End If
  1113.     Next i
  1114.     
  1115.     
  1116.     End With
  1117.     '初始化工具栏,操作状态,显示数据(在由列表过渡到修改状态是用到)
  1118.     Call FrmTlbState(Me.PFrmTlbOprState)
  1119.     Me.Lab_MakeBill.Caption = Xtczy
  1120.     Me.Lab_MakeBill.Tag = Xtczybm
  1121.     Call Sub_OperStatus("1")
  1122.     Call Tlb_Action_ButtonClick(Me.Tlb_Action.Buttons("xz"))
  1123.     Me.dbl_RecordAutoCode = Cg_PlanUnitSplit.CxbbGrid.TextMatrix(Cg_PlanUnitSplit.CxbbGrid.Row, 0)
  1124.     With Cg_PlanUnitSplit.CxbbGrid
  1125.         Set rs_PlanSearch = Cw_DataEnvi.DataConnect.Execute("select KjYear,Period,MNumber,MName,Model,PurUnitName,Sum(Quantity) as SumQuantity from  Cg_V_PlanBill where PurPlanMainID='" & .TextMatrix(.Row, 0) & "'  and ProcFactory =''group by MNumber,MName,Model,PurUnitName,KjYear,Period")
  1126.             
  1127.             WglrGrid.TextMatrix(1, Sydz("001", GridStr(), Szzls)) = Trim(rs_PlanSearch!MNumber)  '物料编码
  1128.             WglrGrid.TextMatrix(1, Sydz("002", GridStr(), Szzls)) = Trim("" & rs_PlanSearch!MName) '物料名称
  1129.             WglrGrid.TextMatrix(1, Sydz("003", GridStr(), Szzls)) = Trim("" & rs_PlanSearch!Model) '规格型号
  1130.             WglrGrid.TextMatrix(1, Sydz("004", GridStr(), Szzls)) = Trim("" & rs_PlanSearch!PurUnitName) '计量单位
  1131.             WglrGrid.TextMatrix(1, 0) = "*"
  1132.             WglrGrid.RowHeight(WglrGrid.Rows - 1) = Sjhgd
  1133.             ReDim Material_Num(rs_PlanSearch.RecordCount - 1)
  1134.             ReDim Material_Str(rs_PlanSearch.RecordCount - 1)
  1135.             Lng_KjYear = rs_PlanSearch.Fields("KjYear")
  1136.             Lng_Period = rs_PlanSearch.Fields("Period")
  1137.             Dim j As Long
  1138.             plan_material_num = rs_PlanSearch.RecordCount - 1
  1139.             j = 0
  1140.             Do While Not rs_PlanSearch.EOF()
  1141.                 Material_Num(j) = S2N(Trim(rs_PlanSearch("SumQuantity")))
  1142.                 Material_Str(j) = Trim(rs_PlanSearch("MNumber"))
  1143.                 rs_PlanSearch.MoveNext
  1144.                 j = j + 1
  1145.             Loop
  1146.                
  1147.                 
  1148.             
  1149.     End With
  1150.     WglrGrid.Enabled = True
  1151. End Sub
  1152. Private Sub Form_Unload(Cancel As Integer)           '窗体卸载
  1153.     '清除查询条件
  1154.     ReDim Cxckbm(0)
  1155.     ReDim Cxdjbh(0)
  1156.     Me.dbl_RecordAutoCode = 0
  1157.     Cxdjgs = 0
  1158.    
  1159.     Hqssckbm = ""
  1160.     Hwsshqbm = ""
  1161.    
  1162.     '卸载打印页面窗体
  1163.     Unload Dyymctbl
  1164.    
  1165.    
  1166. End Sub
  1167. Private Sub Sjcsh(Str_Pzclzt As String)              '数据初始化模块(根据实际情况)
  1168.     '[>>根据实际情况初始化
  1169.     Select Case Str_Pzclzt
  1170.      
  1171.         Case "1"   '新增记录
  1172.     
  1173.             '日期默认值为用户选择日期
  1174.        
  1175.        
  1176.             '设置操作状态为浏览
  1177.             Lab_OperStatus = "1"
  1178.             Call Sub_OperStatus("1")
  1179.     
  1180.     End Select
  1181.   
  1182.     '<<]
  1183.   
  1184.     '重 置 网 格
  1185.     Call Sub_AdjustGrid
  1186.   
  1187. End Sub
  1188. Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button)             '用户点击工具条
  1189.      
  1190.     '屏蔽文本框有效性判断
  1191.      
  1192.     Valilock = True
  1193.      
  1194.     '屏蔽网格失去焦点产生的有效性判断
  1195.      
  1196.     Changelock = True
  1197.      
  1198.     Select Case Button.Key
  1199.         Case "ymsz"                                          '页面设置
  1200.             Dyymctbl.Show 1
  1201.         Case "yl"                                            '预 览
  1202.             If Fun_Drfrmyxxpd Then Call bbyl(True)
  1203.         Case "dy"                                            '打 印
  1204.             If Fun_Drfrmyxxpd Then Call bbyl(False)
  1205.         Case "xz"                                            '新 增
  1206.             Call Sub_AddBill
  1207.         Case "zh"                                            '增 行
  1208.             Call zjlrfl
  1209.         Case "sh"                                            '删 行
  1210.             Call Scdqfl
  1211.         Case "bc"                                            '保 存
  1212.             If Fun_Drfrmyxxpd Then Call Sub_SaveBill
  1213.           
  1214.         Case "fh"                                            '退 出
  1215.             Unload Me
  1216.     End Select
  1217.        
  1218.     '解 锁
  1219.     Valilock = False
  1220.     Changelock = False
  1221.         
  1222. End Sub
  1223. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)     '支持热键操作
  1224.     With Me.Tlb_Action
  1225.         Select Case KeyCode
  1226.             Case vbKeyF5
  1227.                 If .Buttons("xz").Enabled = True And .Buttons("xz").Visible = True Then
  1228.                     Call Tlb_Action_ButtonClick(.Buttons("xz"))
  1229.                 End If
  1230.             Case vbKeyF6
  1231.                 If .Buttons("bc").Enabled = True And .Buttons("bc").Visible = True Then
  1232.                     Call Tlb_Action_ButtonClick(.Buttons("bc"))
  1233.                 End If
  1234.             Case vbKeyF3
  1235.                 If .Buttons("xg").Enabled = True And .Buttons("xg").Visible = True Then
  1236.                     Call Tlb_Action_ButtonClick(.Buttons("xg"))
  1237.                 End If
  1238.             Case 27
  1239.                 If .Buttons("fq").Enabled = True And .Buttons("fq").Visible = True Then
  1240.                     Call Tlb_Action_ButtonClick(.Buttons("fq"))
  1241.                 End If
  1242.         End Select
  1243.     End With
  1244. End Sub
  1245. Private Sub FrmTlbState(int_FrmState As Integer)
  1246.     With Me.Tlb_Action
  1247.         Select Case int_FrmState
  1248.             Case 1 '增加
  1249.                 .Buttons("ymsz").Visible = True
  1250.                 .Buttons("yl").Visible = True
  1251.                 .Buttons("dy").Visible = True
  1252.                 .Buttons("xz").Visible = True
  1253.                 .Buttons("xg").Visible = True
  1254.                 .Buttons("sc").Visible = True
  1255.                 .Buttons("zh").Visible = True
  1256.                 .Buttons("sh").Visible = True
  1257.                 .Buttons("bc").Visible = True
  1258.                 .Buttons("fq").Visible = True
  1259.                 .Buttons("cx").Visible = False
  1260.                 .Buttons("first").Visible = False
  1261.                 .Buttons("next").Visible = False
  1262.                 .Buttons("last").Visible = False
  1263.                 .Buttons("prev").Visible = False
  1264.       
  1265.             Case 2  '修改
  1266.                 .Buttons("ymsz").Visible = True
  1267.                 .Buttons("yl").Visible = True
  1268.                 .Buttons("dy").Visible = True
  1269.                 .Buttons("xz").Visible = False
  1270.                 .Buttons("xg").Visible = True
  1271.                 .Buttons("sc").Visible = True
  1272.                 .Buttons("zh").Visible = True
  1273.                 .Buttons("sh").Visible = True
  1274.                 .Buttons("bc").Visible = True
  1275.                 .Buttons("fq").Visible = True
  1276.                 .Buttons("first").Visible = True
  1277.                 .Buttons("next").Visible = True
  1278.                 .Buttons("last").Visible = True
  1279.                 .Buttons("prev").Visible = True
  1280.                 .Buttons("bKey5").Visible = True
  1281.             Case 3 '审核
  1282.                 .Buttons("ymsz").Visible = True
  1283.                 .Buttons("yl").Visible = True
  1284.                 .Buttons("dy").Visible = True
  1285.                 
  1286.                 .Buttons("bKey1").Visible = False
  1287.                 .Buttons("bKey2").Visible = False
  1288.                 
  1289.                 .Buttons("xz").Visible = False
  1290.                 .Buttons("xg").Visible = False
  1291.                 .Buttons("sc").Visible = False
  1292.                 .Buttons("zh").Visible = False
  1293.                 .Buttons("sh").Visible = False
  1294.                 .Buttons("bc").Visible = False
  1295.                 .Buttons("fq").Visible = False
  1296.                 
  1297.                 .Buttons("Check").Visible = True
  1298.                 .Buttons("Uncheck").Visible = True
  1299.                 .Buttons("CheckAll").Visible = True
  1300.                 .Buttons("UncheckAll").Visible = True
  1301.                 .Buttons("sCheck").Visible = True
  1302.                 
  1303.                 .Buttons("first").Visible = True
  1304.                 .Buttons("next").Visible = True
  1305.                 .Buttons("last").Visible = True
  1306.                 .Buttons("prev").Visible = True
  1307.         End Select
  1308.     End With
  1309. End Sub
  1310. Private Sub Sub_OperStatus(Str_Status As String)                 '工具条依据不同状态所进行的变化
  1311.     With Tlb_Action
  1312.     
  1313.         Select Case Str_Status
  1314.     
  1315.             Case "1"   '初始化,放弃新增,放弃查询
  1316.                 '工具条]
  1317.         
  1318.                 .Buttons("ymsz").Enabled = True    '设置
  1319.                 .Buttons("dy").Enabled = True      '打印
  1320.                 .Buttons("yl").Enabled = True      '预览
  1321.                 .Buttons("xz").Enabled = True      '新增
  1322.                 .Buttons("xg").Enabled = False     '修改
  1323.                 .Buttons("sc").Enabled = False     '删除
  1324.                 .Buttons("zh").Enabled = False     '增行
  1325.                 .Buttons("sh").Enabled = False     '删行
  1326.                 .Buttons("bc").Enabled = False     '保存
  1327.                 .Buttons("fq").Enabled = False     '放弃
  1328.                 .Buttons("cx").Enabled = True      '查询
  1329.                 .Buttons("first").Enabled = True  '首张
  1330.                 .Buttons("prev").Enabled = True   '上张
  1331.                 .Buttons("next").Enabled = True   '下张
  1332.                 .Buttons("last").Enabled = True   '末张
  1333.         
  1334.                
  1335.             Case "2"   '新增单据
  1336.       
  1337.                 '工具条
  1338.                 .Buttons("ymsz").Enabled = False    '设置
  1339.                 .Buttons("dy").Enabled = False      '打印
  1340.                 .Buttons("yl").Enabled = False      '预览
  1341.                 .Buttons("xz").Enabled = False      '新增
  1342.                 .Buttons("xg").Enabled = False      '修改
  1343.                 .Buttons("sc").Enabled = False      '删除
  1344.                 .Buttons("zh").Enabled = True       '增行
  1345.                 .Buttons("sh").Enabled = True       '删行
  1346.                 .Buttons("bc").Enabled = True       '保存
  1347.                 .Buttons("fq").Enabled = True       '放弃
  1348.                 .Buttons("cx").Enabled = False      '查询
  1349.                 .Buttons("first").Enabled = False   '首张
  1350.                 .Buttons("prev").Enabled = False    '上张
  1351.                 .Buttons("next").Enabled = False    '下张
  1352.                 .Buttons("last").Enabled = False    '末张
  1353.                 
  1354.                 '录入文本框
  1355.              
  1356.         
  1357.             Case "3"   '修改
  1358.         
  1359.                 '工具条
  1360.                 .Buttons("ymsz").Enabled = False    '设置
  1361.                 .Buttons("dy").Enabled = False      '打印
  1362.                 .Buttons("yl").Enabled = False      '预览
  1363.                 .Buttons("xz").Enabled = False      '新增
  1364.                 .Buttons("xg").Enabled = False      '修改
  1365.                 .Buttons("sc").Enabled = False      '删除
  1366.                 .Buttons("zh").Enabled = True       '增行
  1367.                 .Buttons("sh").Enabled = True       '删行
  1368.                 .Buttons("bc").Enabled = True       '保存
  1369.                 .Buttons("fq").Enabled = True       '放弃
  1370.                 .Buttons("cx").Enabled = False      '查询
  1371.                 .Buttons("first").Enabled = False   '首张
  1372.                 .Buttons("prev").Enabled = False    '上张
  1373.                 .Buttons("next").Enabled = False    '下张
  1374.                 .Buttons("last").Enabled = False    '末张
  1375.   
  1376.         
  1377.             Case "4"   '查询单据)
  1378.                  '工具条
  1379.                 .Buttons("ymsz").Enabled = True    '设置
  1380.                 .Buttons("dy").Enabled = True      '打印
  1381.                 .Buttons("yl").Enabled = True      '预览
  1382.                 .Buttons("xz").Enabled = False     '新增
  1383.                 .Buttons("xg").Enabled = True      '修改
  1384.                 .Buttons("sc").Enabled = True      '删除
  1385.                 .Buttons("zh").Enabled = False     '增行
  1386.                 .Buttons("sh").Enabled = False     '删行
  1387.                 .Buttons("bc").Enabled = False     '保存
  1388.                 .Buttons("fq").Enabled = True      '放弃
  1389.                 .Buttons("cx").Enabled = True      '查询
  1390.                 If Cxdjgs > 1 Then
  1391.                     .Buttons("first").Enabled = False    '首张
  1392.                     .Buttons("prev").Enabled = False     '上张
  1393.                     .Buttons("next").Enabled = True     '下张
  1394.                     .Buttons("last").Enabled = True     '末张
  1395.                 Else
  1396.                     .Buttons("first").Enabled = False    '首张
  1397.                     .Buttons("prev").Enabled = False     '上张
  1398.                     .Buttons("next").Enabled = False     '下张
  1399.                     .Buttons("last").Enabled = False     '末张
  1400.                 End If
  1401.    
  1402.         
  1403.             Case "5"         '放弃修改
  1404.                  '工具条
  1405.                 .Buttons("ymsz").Enabled = True    '设置
  1406.                 .Buttons("dy").Enabled = True      '打印
  1407.                 .Buttons("yl").Enabled = True      '预览
  1408.                 .Buttons("xz").Enabled = True    '新增
  1409.                 .Buttons("xg").Enabled = True      '修改
  1410.                 .Buttons("sc").Enabled = True      '删除
  1411.                 .Buttons("zh").Enabled = False     '增行
  1412.                 .Buttons("sh").Enabled = False     '删行
  1413.                 .Buttons("bc").Enabled = False     '保存
  1414.                 .Buttons("fq").Enabled = False      '放弃
  1415.                 .Buttons("cx").Enabled = True      '查询
  1416.         
  1417.                 If Me.rs_PAutoID.State = 0 Then Exit Sub
  1418.                 If Me.rs_PAutoID.RecordCount = 0 Then
  1419.                     .Buttons("first").Enabled = True     '首张
  1420.                     .Buttons("prev").Enabled = True      '上张
  1421.                     .Buttons("next").Enabled = False     '下张
  1422.                     .Buttons("last").Enabled = False     '末张
  1423.                     Exit Sub
  1424.                 End If
  1425.                 If Me.rs_PAutoID.EOF = True Then
  1426.                     .Buttons("first").Enabled = True     '首张
  1427.                     .Buttons("prev").Enabled = True      '上张
  1428.                     .Buttons("next").Enabled = False     '下张
  1429.                     .Buttons("last").Enabled = False     '末张
  1430.                 ElseIf Me.rs_PAutoID.BOF = True Then
  1431.                     .Buttons("first").Enabled = False    '首张
  1432.                     .Buttons("prev").Enabled = False     '上张
  1433.                     .Buttons("next").Enabled = True      '下张
  1434.                     .Buttons("last").Enabled = True     '末张
  1435.                 Else
  1436.                     .Buttons("first").Enabled = True    '首张
  1437.                     .Buttons("prev").Enabled = True     '上张
  1438.                     .Buttons("next").Enabled = True      '下张
  1439.                     .Buttons("last").Enabled = True     '末张
  1440.        
  1441.                 End If
  1442.        
  1443.             Case "6"   '显示列表单据
  1444.         
  1445.                 '工具条
  1446.                 .Buttons("ymsz").Enabled = False    '设置
  1447.                 .Buttons("dy").Enabled = False      '打印
  1448.                 .Buttons("yl").Enabled = False      '预览
  1449.                 .Buttons("xz").Enabled = False      '新增
  1450.                 .Buttons("xg").Enabled = False      '修改
  1451.                 .Buttons("sc").Enabled = False      '删除
  1452.                 .Buttons("zh").Enabled = False      '增行
  1453.                 .Buttons("sh").Enabled = False      '删行
  1454.                 .Buttons("bc").Enabled = False      '保存
  1455.                 .Buttons("fq").Enabled = False      '放弃
  1456.                 .Buttons("cx").Enabled = False      '查询
  1457.                 .Buttons("first").Enabled = False   '首张
  1458.                 .Buttons("prev").Enabled = False    '上张
  1459.                 .Buttons("next").Enabled = False    '下张
  1460.                 .Buttons("last").Enabled = False    '末张
  1461.         
  1462.                 '录入文本框
  1463.      
  1464.                 WglrGrid.Enabled = True
  1465.                 WglrGrid.Editable = False
  1466.         
  1467.         End Select
  1468.     End With
  1469. End Sub
  1470. Private Sub Wbkcl()                                                 '文本框录入之前处理(根据实际情况)
  1471.     Dim xswbrr As String
  1472.     With WglrGrid
  1473.         Zdlrqnr = Trim(.Text)
  1474.         xswbrr = Trim(.Text)
  1475.     
  1476.         If GridBoolean(.Col, 3) Then   '列表框录入
  1477.     
  1478.        
  1479.         Else
  1480.             Wbkbhlock = True
  1481.        
  1482.             '====以下为用户自定义
  1483.             Ydtext.Text = xswbrr
  1484.              '====以上为用户自定义
  1485.          
  1486.         Wbkbhlock = False
  1487.         Ydtext.SelStart = Len(Ydtext.Text)
  1488.         End If
  1489.     End With
  1490. End Sub
  1491. Private Function sjzdyxxpd(Dqpdwgh As Long, Dqpdwgl As Long)        '录入数据字段有效性判断,同时进行字段录入事后处理
  1492.     Dim Str_JudgeText As String  '临时有效性判断字段内容
  1493.     Dim Coljsq As Long           '临时列计数器
  1494.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  1495.     Dim Str_Temp As String
  1496.     Dim rs_Temp As New ADODB.Recordset
  1497.  
  1498.     pdzwx = False
  1499.     With WglrGrid
  1500.     
  1501.         '非录入状态有效性为合法
  1502.         If Yxxpdlock Or .Row < .FixedRows Then
  1503.             sjzdyxxpd = True
  1504.             Exit Function
  1505.         End If
  1506.  
  1507.         Str_JudgeText = Trim(.TextMatrix(Dqpdwgh, Dqpdwgl))
  1508.         Select Case GridStr(Dqpdwgl, 1)
  1509.             '以下为自定义部分[
  1510.             Case "001"
  1511.                 If Trim(Me.WglrGrid.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))) = "" Then Exit Function
  1512.                 Str_Temp = "select * from CG_V_Material where MNumber ='" & Trim(Me.WglrGrid.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))) & "' and isPurchase =1"
  1513.                 Set rs_Temp = Cw_DataEnvi.DataConnect.Execute(Str_Temp)
  1514.                 If rs_Temp.EOF Then
  1515.                     Tsxx = "此物料编码不存在或不具备采购属性!"
  1516.                     GoTo Lrcwcl
  1517.                 End If
  1518.                 Set rs_Temp = Nothing
  1519.                 Str_Temp = "select * from CG_V_PlanBill where MNumber ='" & Trim(Me.WglrGrid.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))) & "' and PurPlanMainID='" & Me.dbl_RecordAutoCode & "' and ProcFactory=''"
  1520.                 Set rs_Temp = Cw_DataEnvi.DataConnect.Execute(Str_Temp)
  1521.                 If Not rs_Temp.EOF() Then
  1522.                     .TextMatrix(Dqpdwgh, Sydz("002", GridStr(), Szzls)) = Trim(rs_Temp.Fields("MName"))
  1523.                     .TextMatrix(Dqpdwgh, Sydz("003", GridStr(), Szzls)) = Trim(rs_Temp.Fields("Model"))
  1524.                     .TextMatrix(Dqpdwgh, Sydz("004", GridStr(), Szzls)) = Trim(rs_Temp.Fields("PurUnitName"))
  1525.                 Else
  1526.                     Tsxx = "此拆分计划中不存在此物料编码或此物料编码已指定生产厂家!"
  1527.                     GoTo Lrcwcl
  1528.                 End If
  1529.             Case "005"  '供应商
  1530.                 If Not Trim(.TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls))) = "" Then
  1531.                     str_Cmp = Trim(Me.WglrGrid.TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls)))
  1532.                     Str_Temp = "select * from Gy_Supplier where (SupplierCode ='" & str_Cmp & "' or SupplierName='" & str_Cmp & "') and StopFlag=0 "
  1533.                     Set rs_Temp = Cw_DataEnvi.DataConnect.Execute(Str_Temp)
  1534.                     If rs_Temp.EOF() Then
  1535.                         Tsxx = "此供应商不存在或已经停用!"
  1536.                         GoTo Lrcwcl
  1537.                     Else
  1538.                         Me.WglrGrid.TextMatrix(Dqpdwgh, 1) = Trim(rs_Temp.Fields("SupplierCode"))
  1539.                         Me.WglrGrid.TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls)) = Trim(rs_Temp.Fields("SupplierName"))
  1540.                     End If
  1541.                 End If
  1542.             Case "006"
  1543.                 If Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))) = "" Then
  1544.                     Exit Function
  1545.                 End If
  1546.                 
  1547.                 If (Not IsNumeric(Trim(.TextMatrix(Dqpdwgh, Sydz(GridStr(Dqpdwgl, 1), GridStr(), Szzls))))) And Trim(.TextMatrix(Dqpdwgh, Sydz(GridStr(Dqpdwgl, 1), GridStr(), Szzls))) <> "" Then
  1548.                     Tsxx = "请输入数字!"
  1549.                     GoTo Lrcwcl
  1550.                 Else
  1551.                     .TextMatrix(Dqpdwgh, Sydz(GridStr(Dqpdwgl, 1), GridStr(), Szzls)) = S2N(Trim(.TextMatrix(Dqpdwgh, Sydz(GridStr(Dqpdwgl, 1), GridStr(), Szzls))))
  1552.                     If S2N(Trim(.TextMatrix(Dqpdwgh, Sydz(GridStr(Dqpdwgl, 1), GridStr(), Szzls)))) < 0 Then
  1553.                         Tsxx = "数量不能小于零!"
  1554.                         GoTo Lrcwcl
  1555.                     End If
  1556.                 End If
  1557.                 Dim Num_Tmp As Double
  1558.                 Dim Jsq_Tmp As Integer
  1559.                 Num_Tmp = 0
  1560.                 For Jsq_Tmp = 1 To Dqpdwgh
  1561.                     If Trim(.TextMatrix(Jsq_Tmp, Sydz("001", GridStr(), Szzls))) = Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))) Then
  1562.                         Num_Tmp = Num_Tmp + S2N(Me.WglrGrid.TextMatrix(Jsq_Tmp, Sydz("006", GridStr(), Szzls)))
  1563.                     End If
  1564.                 Next Jsq_Tmp
  1565.                 Dim i As Long
  1566.                 For i = 0 To plan_material_num
  1567.                     If Material_Str(i) = Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))) Then
  1568.                     Exit For
  1569.                     End If
  1570.                 Next i
  1571.                 If Num_Tmp > Material_Num(i) Then
  1572.                     Tsxx = "数量已经超过原计划数量!"
  1573.                     GoTo Lrcwcl
  1574.                 End If
  1575.        '以上为自定义部分]
  1576.             
  1577.         End Select
  1578.         '字段录入正确后为零字段清空
  1579.         Call Qkwlzd(Dqpdwgh, Dqpdwgl)
  1580.         sjzdyxxpd = True
  1581.         Yxxpdlock = True
  1582.         Exit Function
  1583.     End With
  1584.   
  1585. Lrcwcl:    '录入错误处理
  1586.     With WglrGrid
  1587.         Call Xtxxts(Tsxx, 0, 1)
  1588.         Changelock = True
  1589.         .Select Dqpdwgh, Dqpdwgl
  1590.         Changelock = False
  1591.         Call xswbk
  1592.         sjzdyxxpd = False
  1593.         Exit Function
  1594.     End With
  1595. End Function
  1596. Private Function Sjhzyxxpd(ByVal Yxxpdh As Long) As Boolean                  '录入数据行有效性判断,同时进行行处理
  1597.     Dim Lrywlz As Long
  1598.     Dim RecTemp As New ADODB.Recordset
  1599.     Dim Yxrow As Long
  1600.  
  1601.     With WglrGrid
  1602.         If Yxxpdh > (.Rows - .FixedRows) Then Exit Function
  1603.         If .TextMatrix(Yxxpdh, 0) <> "*" Then
  1604.             Sjhzyxxpd = True
  1605.             Exit Function
  1606.         Else
  1607.             If pdhwk(Yxxpdh) And Yxxpdh + 1 <= .Rows - 1 Then
  1608.                 If .TextMatrix(Yxxpdh + 1, 0) <> "*" Then
  1609.                     Changelock = True
  1610.                     .RemoveItem Yxxpdh
  1611.                     If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  1612.                         .AddItem ""
  1613.                         .RowHeight(.Rows - 1) = Sjhgd
  1614.                     End If
  1615.                     Changelock = False
  1616.                     Sjhzyxxpd = True
  1617.                     Exit Function
  1618.                 End If
  1619.             End If
  1620.         End If
  1621.     
  1622.         If Hyxxpdlock Then
  1623.             Sjhzyxxpd = True
  1624.             Exit Function
  1625.         End If
  1626.   
  1627.         '以下为自定义部分[
  1628.    
  1629.         '1.放置行有效性判断程序
  1630.            
  1631.         For jsqte = Qslz To .Cols - 1
  1632.             
  1633.             '字段不能为空
  1634.             If GridInt(jsqte, 5) = 1 Then
  1635.                 If Len(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0 Then
  1636.                     Tsxx = GridStr(jsqte, 2)
  1637.                     Lrywlz = jsqte
  1638.                     GoTo Lrcwcl
  1639.                     Exit For
  1640.                 End If
  1641.             End If
  1642.             
  1643.             '字段不能为零
  1644.             If GridInt(jsqte, 5) = 2 Then
  1645.                 If S2N(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0 Then
  1646.                     Tsxx = GridStr(jsqte, 2)
  1647.                     Lrywlz = jsqte
  1648.                     GoTo Lrcwcl
  1649.                     Exit For
  1650.                 End If
  1651.             End If
  1652.         Next jsqte
  1653.            
  1654.            '自定义判断(补丁)
  1655.             
  1656.            
  1657.             
  1658.         '2.放置行处理程序
  1659.            
  1660.        
  1661.     
  1662.     '以上为自定义部分]
  1663.  
  1664.     End With
  1665.  
  1666.     Sjhzyxxpd = True
  1667.     Hyxxpdlock = True
  1668.     Exit Function
  1669.  
  1670. Lrcwcl:      '录入错误处理
  1671.     With WglrGrid
  1672.         Call Xtxxts(Tsxx, 0, 1)
  1673.         Changelock = True
  1674.         .Select Yxxpdh, Lrywlz
  1675.         Changelock = False
  1676.         Call xswbk
  1677.         Sjhzyxxpd = False
  1678.         Exit Function
  1679.     End With
  1680. End Function
  1681. Private Sub Sub_AddBill()                                                '新增一张单据
  1682.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  1683.     Dim jsqte As Long            '临时计数器
  1684.    
  1685.     '设置操作状态为新增
  1686.     Lab_OperStatus.Caption = "2"
  1687.     
  1688.     '设置工具条状态
  1689.     Call Sub_OperStatus("2")
  1690.     '重置网格
  1691.    
  1692.     With WglrGrid
  1693.         .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  1694.         For jsqte = .FixedRows To .Rows - 1
  1695.             .RowHeight(jsqte) = Sjhgd
  1696.         Next jsqte
  1697.   
  1698.         .Clear 1
  1699.         Changelock = True
  1700.         .Select .FixedRows, Qslz
  1701.         Changelock = False
  1702.      
  1703.     End With
  1704.    
  1705.     '计算合计数据(清零)
  1706.     For jsqte = Qslz To WglrGrid.Cols - 1
  1707.         Call Sjhj(jsqte)
  1708.     Next jsqte
  1709.     
  1710.     
  1711.    '初始化默认数据
  1712.    '凭证类别得到焦点
  1713.   
  1714.     Me.WglrGrid.Enabled = True
  1715.         
  1716. End Sub
  1717. Private Sub Sub_ClearBill()             '放弃清除
  1718.     Dim jsqte As Long
  1719.   
  1720.     '清除文本框内容
  1721.     TextChangeLock = True
  1722.   
  1723.     '清除网格内容
  1724.     With WglrGrid
  1725.         .Clear 1
  1726.     End With
  1727.   
  1728.     '初始化合计网格
  1729.     Call Cshhjwg
  1730.     TextChangeLock = False
  1731. End Sub
  1732. Private Function Sub_SaveBill() As Boolean                   '保 存 单 据
  1733.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  1734.     Dim Recfind As New ADODB.Recordset     '有效性判断动态集
  1735.     Dim Rowjsq As Long           '网格行计数器
  1736.     Dim Coljsq As Long           '网格列计数器
  1737.     Dim jsqte As Integer         '临时计数器
  1738.     Dim Int_RowCount As Integer  '有效数据行计数器
  1739.     Dim Bln_AssVali As Boolean   '辅助核算错误标识
  1740.     Dim Lrywlz As Long           '录入有误列值
  1741.     Dim Dbl_Jfhj As Double       '借方合计
  1742.     Dim Dbl_Dfhj As Double       '贷方合计
  1743.     Dim Int_Year As Integer      '用户选择会计年度
  1744.     Dim Int_Period As Integer    '用户选择会计期间
  1745.     Dim Int_VouchNo As Integer   '单据号
  1746.     Dim i, j As Long
  1747.     Dim Str_Temp As String
  1748.     Dim Num_Total As Double      '当前拆分的物料数量
  1749.   
  1750.  
  1751.     '对需要进行事后判断的文本框录入内容进行有效性判断 (固定不变)
  1752.   
  1753.     '[判断用户所选会计期间是否有效(非结帐月份),且制单日期必须和所选会计期间一致
  1754.   
  1755.   
  1756.     '下面将对所有有效数据行进行有效性判断
  1757.   
  1758.     Int_RowCount = 0
  1759.   
  1760.     With WglrGrid
  1761.         Str_Temp = ""
  1762.      
  1763.         For Rowjsq = .FixedRows To .Rows
  1764.      
  1765.             '带*号者为有效数据行
  1766.          
  1767.             If Trim(.TextMatrix(Rowjsq, 0)) <> "*" Then
  1768.                 Exit For
  1769.             Else
  1770.                 Int_RowCount = Int_RowCount + 1
  1771.             End If
  1772.          
  1773.             '1.首先进行为空或为零判断(Fixed)
  1774.             For Coljsq = Qslz To .Cols - 1
  1775.                 If (GridInt(Coljsq, 5) = 1 And Len(Trim("" & .TextMatrix(Rowjsq, Coljsq))) = 0) Then
  1776.                     If Not .ColHidden(Coljsq) Then
  1777.                         Tsxx = GridStr(Coljsq, 2)
  1778.                         Lrywlz = Coljsq
  1779.                         GoTo Lrcwcl
  1780.                         Exit For
  1781.                     End If
  1782.                 End If
  1783.                 If GridInt(Coljsq, 5) = 2 Then
  1784.                     If Not .ColHidden(Coljsq) Then
  1785.                         If S2N(Trim("" & .TextMatrix(Rowjsq, Coljsq))) = 0 Then
  1786.                             Tsxx = GridStr(Coljsq, 2)
  1787.                             Lrywlz = Coljsq
  1788.                             GoTo Lrcwcl
  1789.                             Exit For
  1790.                         End If
  1791.                     End If
  1792.                 End If
  1793.             Next Coljsq
  1794.         Next Rowjsq
  1795.    
  1796.             
  1797.         '分录行数不能为零
  1798.      
  1799.         If Int_RowCount = 0 Then
  1800.             Tsxx = "单据录入行数为零,不能存盘!"
  1801.             Call Xtxxts(Tsxx, 0, 1)
  1802.             Exit Function
  1803.         End If
  1804.      
  1805.         '记录拆分情况
  1806.         ReDim Preserve arrStr_MNum(0)
  1807.         arrStr_MNum(0) = Trim(.TextMatrix(.FixedRows, Sydz("001", GridStr(), Szzls)))
  1808.         ReDim Preserve arrDbl_Quan(0)
  1809.         arrDbl_Quan(0) = .TextMatrix(.FixedRows, Sydz("006", GridStr(), Szzls))
  1810.     
  1811.         For i = .FixedRows + 1 To .Rows - 1
  1812.             If Trim(.TextMatrix(i, 0)) = "*" Then
  1813.                 For j = LBound(arrStr_MNum, 1) To UBound(arrStr_MNum, 1)
  1814.                     If Trim(.TextMatrix(i, Sydz("001", GridStr(), Szzls))) = Trim(arrStr_MNum(j)) Then
  1815.                         arrDbl_Quan(j) = arrDbl_Quan(j) + S2N(.TextMatrix(i, Sydz("006", GridStr(), Szzls)))
  1816.                         Exit For
  1817.                     End If
  1818.                 Next j
  1819.                 If j > UBound(arrStr_MNum, 1) Then
  1820.                     ReDim Preserve arrStr_MNum(UBound(arrStr_MNum, 1) + 1)
  1821.                     arrStr_MNum(UBound(arrStr_MNum, 1)) = Trim(.TextMatrix(i, Sydz("001", GridStr(), Szzls)))
  1822.                     ReDim Preserve arrDbl_Quan(UBound(arrDbl_Quan, 1) + 1)
  1823.                     arrDbl_Quan(UBound(arrDbl_Quan, 1)) = S2N(.TextMatrix(i, Sydz("006", GridStr(), Szzls)))
  1824.                 End If
  1825.             End If
  1826.         Next i
  1827.     
  1828.     
  1829.     End With  '网格
  1830.   
  1831.     Str_Temp = "select * from Cg_PurPlanMain where PurPlanMainID='" & Me.dbl_RecordAutoCode & "'"
  1832.     Set rs_From(0) = Cw_DataEnvi.DataConnect.Execute(Str_Temp)
  1833.     Str_Temp = "select MNumber,Sum(Quantity) as SumQuantity from Cg_V_PlanBill where PurPlanMainID='" & Me.dbl_RecordAutoCode & "' and ProcFactory='' Group By MNumber"
  1834.     Set rs_From(1) = Cw_DataEnvi.DataConnect.Execute(Str_Temp)
  1835.     With rs_From(1)
  1836.         ReDim arrStr_LeftMNum(.RecordCount - 1)
  1837.         ReDim arrDbl_LeftQuan(.RecordCount - 1)
  1838.         j = LBound(arrStr_LeftMNum, 1)
  1839.         Do While Not .EOF()
  1840.             arrStr_LeftMNum(j) = Trim(.Fields("MNumber"))
  1841.             arrDbl_LeftQuan(j) = .Fields("SumQuantity")
  1842.             For i = LBound(arrStr_MNum, 1) To UBound(arrStr_MNum, 1)
  1843.                 If arrStr_LeftMNum(j) = arrStr_MNum(i) Then
  1844.                     arrDbl_LeftQuan(j) = arrDbl_LeftQuan(j) - arrDbl_Quan(i)
  1845.                     If arrDbl_LeftQuan(j) < 0 Then
  1846.                         Call Xtxxts(arrStr_MNum(i) & "数量超出计划范围", 0, 4)
  1847.                         Exit Function
  1848.                     End If
  1849.                     Exit For
  1850.                 End If
  1851.             Next i
  1852.             .MoveNext
  1853.             j = j + 1
  1854.         Loop
  1855.     End With
  1856.     If FnBln_SaveData(S2N(Lab_OperStatus)) Then
  1857.         Sub_SaveBill = True
  1858.         Tsxx = "单据存盘完毕! "
  1859.         Call Xtxxts(Tsxx, 0, 4)
  1860.         bln_IsChanged = True
  1861.         Call Sub_OperStatus("1")
  1862.         Xtfhcs = "1"
  1863.         WglrGrid.Enabled = False
  1864.         Exit Function
  1865.     Else
  1866.         GoTo Swcwcl
  1867.     End If
  1868.     Exit Function
  1869. Swcwcl:
  1870.      
  1871.      Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
  1872.      Call Xtxxts(Tsxx, 0, 1)
  1873.      Exit Function
  1874. Lrcwcl:        '录入错误处理
  1875.     With WglrGrid
  1876.         Call Xtxxts("(第 " + Trim(Str(Int_RowCount)) + " 条会计分录)-" + Tsxx, 0, 1)
  1877.         Changelock = True
  1878.         .Select Rowjsq, Lrywlz
  1879.         WglrGrid.SetFocus
  1880.         Changelock = False
  1881.         Exit Function
  1882.     End With
  1883. End Function
  1884. Private Sub Chk_DeleteMess_Click()                   '删行是否提示(点击)
  1885.     If Chk_DeleteMess.Value = 1 Then
  1886.         Shsfts = True
  1887.     Else
  1888.         Shsfts = False
  1889.     End If
  1890. End Sub
  1891. Private Function Fun_AllowEdit() As Boolean                      '判断当前单据是否允许编辑或删除
  1892.   
  1893.     Fun_AllowEdit = True
  1894. End Function
  1895. Private Sub Sub_AdjustGrid()
  1896.     
  1897.     '调 整 网 格
  1898.     With WglrGrid
  1899.         '加 1 保持一行录入行
  1900.         If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  1901.             .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  1902.             For jsqte = .FixedRows To .Rows - 1
  1903.                 .RowHeight(jsqte) = Sjhgd
  1904.             Next jsqte
  1905.         End If
  1906.         
  1907.         '判断是否有辅助行和录入行,如没有则加行
  1908.         Do While .TextMatrix(.Rows - 1 - Fzxwghs, 0) = "*"
  1909.             .AddItem ""
  1910.             .RowHeight(.Rows - 1) = Sjhgd
  1911.         Loop
  1912.     
  1913.     End With
  1914.     
  1915. End Sub
  1916. Private Sub Lrzdbz()                                                      '录入字段帮助
  1917.     
  1918.     If Not Ydcommand.Visible Then
  1919.         Exit Sub
  1920.     End If
  1921.    
  1922.     With WglrGrid
  1923.         Valilock = True
  1924.     
  1925.         '处理通用部分
  1926.         Changelock = True        '调入另外窗体必须加锁
  1927.         Call Drbmhelp(GridInt(.Col, 6), GridStr(.Col, 3), Trim(Ydtext.Text))
  1928.         Changelock = False
  1929.         
  1930.         If Len(Xtfhcs) <> 0 Then
  1931.             If GridInt(.Col, 7) = 0 Then
  1932.                 Ydtext.Text = Xtfhcs
  1933.             Else
  1934.                 Ydtext.Text = Xtfhcsfz
  1935.             End If
  1936.         End If
  1937.         
  1938.         Valilock = False
  1939.         If Ydtext.Visible Then
  1940.             Ydtext.SetFocus
  1941.         End If
  1942.     End With
  1943. End Sub
  1944. Private Sub Cshhjwg()                                                     '初始化合计网格(*对合计网格来说,录入网格为容器)
  1945.     
  1946.     With HjGrid
  1947.     
  1948.        '是否显示合计网格
  1949.        If Not Sfxshjwg Then
  1950.            .Visible = False
  1951.            Exit Sub
  1952.        Else
  1953.            .Visible = True
  1954.        End If
  1955.       
  1956.        '设置网格相关属性
  1957.        .Enabled = False
  1958.        .Appearance = flexFlat
  1959.        .BorderStyle = flexBorderNone
  1960.        .ScrollBars = flexScrollBarNone
  1961.        .Width = WglrGrid.Width
  1962.        .FixedRows = 0
  1963.        .Rows = 1
  1964.        .Cols = WglrGrid.Cols
  1965.        .LeftCol = WglrGrid.LeftCol
  1966.        .TextMatrix(0, Qslz) = "合  计"
  1967.        For jsqte = 0 To WglrGrid.Cols - 1
  1968.            .ColHidden(jsqte) = WglrGrid.ColHidden(jsqte)
  1969.            .ColWidth(jsqte) = WglrGrid.ColWidth(jsqte)
  1970.            .ColAlignment(jsqte) = WglrGrid.ColAlignment(jsqte)
  1971.            .ColFormat(jsqte) = WglrGrid.ColFormat(jsqte)
  1972.        Next jsqte
  1973.        .ColAlignment(Qslz) = flexAlignCenterTop
  1974.        For jsqte = .FixedRows To .Rows - 1
  1975.            .RowHeight(jsqte) = .Height / .Rows
  1976.        Next jsqte
  1977.        
  1978.       '程序自动调整网格高度(自动设置为网格剩余高度+辅助项网格行数(默认为1)*数据行高度)、并设置其位置信息
  1979.        .Height = Fzxwghs * Sjhgd + ((WglrGrid.Height - WglrGrid.FixedRows * WglrGrid.RowHeight(0)) Mod Sjhgd)
  1980.        .RowHeight(0) = .Height
  1981.        .Move 0, WglrGrid.Height - .Height, WglrGrid.Width, .Height
  1982.     End With
  1983. End Sub
  1984. Private Sub Form_Resize()                                                '窗体大小发生变化时,重新显示文本框
  1985.    Call Cxxswbk
  1986. End Sub
  1987. Private Function Fun_Drfrmyxxpd() As Boolean                             '调入其它窗体或功能产生的有效性判断(包括数据回写)
  1988.     Fun_Drfrmyxxpd = True
  1989.     With WglrGrid
  1990.    
  1991.         '如果当前网格处于编辑状态,则先进行数据回写再进行有效性判断
  1992.         If Ydtext.Visible Or YdCombo.Visible Then
  1993.             Call Lrsjhx
  1994.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1995.                 Fun_Drfrmyxxpd = False
  1996.                 Exit Function
  1997.             End If
  1998.         End If
  1999.    
  2000.         '进行行有效性判断
  2001.         If Not Sjhzyxxpd(.Row) Then
  2002.             Fun_Drfrmyxxpd = False
  2003.             Exit Function
  2004.         End If
  2005.     End With
  2006. End Function
  2007. Private Sub WglrGrid_AfterUserResize(ByVal Row As Long, ByVal Col As Long)       '调整列宽
  2008.     
  2009.     If HjGrid.Visible Then
  2010.         With HjGrid
  2011.             .ColWidth(Col) = WglrGrid.ColWidth(Col)
  2012.         End With
  2013.     End If
  2014. End Sub
  2015. Private Sub WglrGrid_EnterCell()                                                 '显示当前数据行相关信息
  2016.     
  2017.     With WglrGrid
  2018.         If .Row >= .FixedRows Then
  2019.             '[>>
  2020.             '此处可以填写显示与此网格行相关信息
  2021.             '<<]
  2022.         End If
  2023.     End With
  2024. End Sub
  2025. Private Sub WglrGrid_GotFocus()                                     '网格得到焦点
  2026.     '网格得到焦点,如果当前选择行为非数据行
  2027.     '则调整当前焦点至有效数据行
  2028.     With WglrGrid
  2029.         If .Row < .FixedRows And .Rows > .FixedRows Then
  2030.             Changelock = True
  2031.             .Select .FixedRows, .Col
  2032.             Changelock = False
  2033.         End If
  2034.         If .Col < Qslz Then
  2035.             Changelock = True
  2036.             .Select .Row, Qslz
  2037.             Changelock = False
  2038.         End If
  2039.     End With
  2040. End Sub
  2041. Private Sub WglrGrid_LostFocus()                                    '录入网格失去焦点
  2042.     '用以屏蔽调用其它窗体时发生网格失去焦点事件
  2043.     If Changelock Then
  2044.         Exit Sub
  2045.     End If
  2046.     '引发网格RowcolChange事件
  2047.     With WglrGrid
  2048.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  2049.             .Select 0, 0
  2050.         End If
  2051.     End With
  2052. End Sub
  2053. Private Sub WglrGrid_AfterScroll(ByVal OldTopRow As Long, ByVal OldLeftCol As Long, ByVal NewTopRow As Long, ByVal NewLeftCol As Long)                                       '限制用户在录入过程中滚动鼠标
  2054.     If Gdtlock Then
  2055.         Exit Sub
  2056.     End If
  2057.  
  2058.     With WglrGrid
  2059.         If Ydtext.Visible Or YdCombo.Visible Then
  2060.             Gdtlock = True
  2061.             .TopRow = Dqtoprow
  2062.             .LeftCol = Dqleftcol
  2063.             Gdtlock = False
  2064.             Exit Sub
  2065.         End If
  2066.         HjGrid.LeftCol = .LeftCol
  2067.     End With
  2068. End Sub
  2069. Private Sub WglrGrid_LeaveCell()                                    '离开单元格
  2070.     
  2071.     If Changelock Then
  2072.         Exit Sub
  2073.     End If
  2074.     '记录刚刚离开网格单元的行列值
  2075.     Dqlkwgh = WglrGrid.Row
  2076.     Dqlkwgl = WglrGrid.Col
  2077.     '判断是否需要录入数据回写
  2078.     If Not (Ydtext.Visible Or YdCombo.Visible) Then
  2079.         Exit Sub
  2080.     End If
  2081.     Call Lrsjhx
  2082. End Sub
  2083. Private Sub WglrGrid_RowColChange()                                '网格录入行列发生变化时,进行有效性判断
  2084.     Valilock = True       '屏蔽文本框失去焦点进行有效性判断
  2085.     With WglrGrid
  2086.         If Changelock Then
  2087.             Exit Sub
  2088.         End If
  2089.         If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  2090.             Exit Sub
  2091.         End If
  2092.         If .Row <> Dqlkwgh Then
  2093.             If Not Sjhzyxxpd(Dqlkwgh) Then
  2094.                 Exit Sub
  2095.             End If
  2096.         End If
  2097.     End With
  2098.    
  2099.     Call fhyxh
  2100.     Call Xldql
  2101.    
  2102. End Sub
  2103. Private Sub WglrGrid_DblClick()          '鼠标双击网格显示文本框
  2104.   
  2105.     With WglrGrid
  2106.         Call xswbk
  2107.     End With
  2108. End Sub
  2109. Private Sub Ycwbk()                      '隐藏文本框,帮助按钮,列表组合框
  2110.     
  2111.     Valilock = True
  2112.     Ydtext.Visible = False
  2113.     YdCombo.Visible = False
  2114.     Ydcommand.Visible = False
  2115. End Sub
  2116. Private Sub YdCombo_KeyDown(KeyCode As Integer, Shift As Integer)        '列表框移动
  2117.     With WglrGrid
  2118.         Select Case KeyCode
  2119.             Case vbKeyEscape                'ESC 键放弃录入
  2120.                 Valilock = True
  2121.                 .SetFocus
  2122.                 Call Ycwbk
  2123.                 Valilock = False
  2124.             Case vbKeyReturn                '回 车 键 =13
  2125.                 KeyCode = 0
  2126.                 .SetFocus
  2127.                 Call Lrsjhx
  2128.                 Rowjsq = .Row
  2129.                 Coljsq = .Col + 1
  2130.                 If Coljsq > .Cols - 1 Then
  2131.                     If Rowjsq < .Rows - 1 Then
  2132.                         Rowjsq = Rowjsq + 1
  2133.                     End If
  2134.                     Coljsq = Qslz
  2135.                 End If
  2136.                 Do While Rowjsq <= .Rows - 1
  2137.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  2138.                         Coljsq = Coljsq + 1
  2139.                         If Coljsq > .Cols - 1 Then
  2140.                             Rowjsq = Rowjsq + 1
  2141.                             Coljsq = Qslz
  2142.                         End If
  2143.                     Else
  2144.                         Exit Do
  2145.                     End If
  2146.                 Loop
  2147.                 .Select Rowjsq, Coljsq
  2148.             Case vbKeyLeft                  '左 箭 头 =37
  2149.                 If .Col - 1 = Qslz Then
  2150.                     If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  2151.                         GoTo jzzx
  2152.                     End If
  2153.                 End If
  2154.                 If .Col > Qslz Then
  2155.                     KeyCode = 0
  2156.                     .SetFocus
  2157.                     Call Lrsjhx
  2158.                     Coljsq = .Col - 1
  2159.                     Do While Coljsq > Qslz
  2160.                         If Coljsq - 1 = Qslz Then
  2161.                             If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  2162.                                 GoTo jzzx
  2163.                             End If
  2164.                         End If
  2165.                         If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  2166.                             Coljsq = Coljsq - 1
  2167.                         Else
  2168.                             Exit Do
  2169.                         End If
  2170.                     Loop
  2171.                     .Select .Row, Coljsq
  2172.                 End If
  2173.             Case vbKeyRight                 '右 箭 头 =39
  2174.                 KeyCode = 0
  2175.                 .SetFocus
  2176.                 Call Lrsjhx
  2177.                 Rowjsq = .Row
  2178.                 Coljsq = .Col + 1
  2179.                 If Coljsq > .Cols - 1 Then
  2180.                     If Rowjsq < .Rows - 1 Then
  2181.                         Rowjsq = Rowjsq + 1
  2182.                     End If
  2183.                     Coljsq = Qslz
  2184.                 End If
  2185.                 Do While Rowjsq <= .Rows - 1
  2186.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  2187.                         Coljsq = Coljsq + 1
  2188.                         If Coljsq > .Cols - 1 Then
  2189.                             Rowjsq = Rowjsq + 1
  2190.                             Coljsq = Qslz
  2191.                         End If
  2192.                     Else
  2193.                         Exit Do
  2194.                     End If
  2195.                 Loop
  2196.                 .Select Rowjsq, Coljsq
  2197.         Case Else
  2198.    End Select
  2199.    
  2200. jzzx:
  2201.    
  2202.     End With
  2203. End Sub
  2204. Private Sub YdCombo_LostFocus()
  2205.   
  2206.     With WglrGrid                                    '因为选中网格会先发生Rowcolchange事件置Valiock
  2207.         If Not Valilock Then                           '为TRUE
  2208.             Call Lrsjhx
  2209.             If Not Sjhzyxxpd(Dqlrwgh) Then
  2210.                 Exit Sub
  2211.             End If
  2212.         End If
  2213.     End With
  2214. End Sub
  2215. Private Sub Ydcommand_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  2216.     Call Lrzdbz
  2217. End Sub
  2218. Private Sub ydtext_KeyDown(KeyCode As Integer, Shift As Integer)
  2219.     Dim Rowjsq As Long, Coljsq As Long
  2220.     With WglrGrid
  2221.         Select Case KeyCode
  2222.             Case vbKeyF2
  2223.                 Call Lrzdbz
  2224.             Case vbKeyEscape                'ESC 键放弃录入
  2225.                 Valilock = True
  2226.                 Call Ycwbk
  2227.                 .SetFocus
  2228.             Case vbKeyReturn                '回 车 键 =13
  2229.                 KeyCode = 0
  2230.                 .SetFocus
  2231.                 Call Lrsjhx
  2232.                 Rowjsq = .Row
  2233.                 Coljsq = .Col + 1
  2234.                 If Coljsq > .Cols - 1 Then
  2235.                     If Rowjsq < .Rows - 1 Then
  2236.                         Rowjsq = Rowjsq + 1
  2237.                     End If
  2238.                     Coljsq = Qslz
  2239.                 End If
  2240.                 Do While Rowjsq <= .Rows - 1
  2241.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  2242.                         Coljsq = Coljsq + 1
  2243.                         If Coljsq > .Cols - 1 Then
  2244.                             Rowjsq = Rowjsq + 1
  2245.                             Coljsq = Qslz
  2246.                         End If
  2247.                     Else
  2248.                         Exit Do
  2249.                     End If
  2250.                 Loop
  2251.                 If Rowjsq <= .Rows - 1 Then
  2252.                     .Select Rowjsq, Coljsq
  2253.                 End If
  2254.             Case vbKeyUp                    '上 箭 头 =38
  2255.                 KeyCode = 0
  2256.                 .SetFocus
  2257.                 Call Lrsjhx
  2258.                 If .Row > .FixedRows Then
  2259.                     .Row = .Row - 1
  2260.                 End If
  2261.             Case vbKeyDown                  '下 箭 头 =40
  2262.                 KeyCode = 0
  2263.                 .SetFocus
  2264.                 Call Lrsjhx
  2265.                 If .Row < .Rows - 1 Then
  2266.                     .Row = .Row + 1
  2267.                 End If
  2268.             Case vbKeyLeft                  '左 箭 头 =37
  2269.                 If .Col - 1 = Qslz Then
  2270.                     If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  2271.                         GoTo jzzx
  2272.                     End If
  2273.                 End If
  2274.                 If Ydtext.SelStart = 0 And .Col > Qslz Then
  2275.                     KeyCode = 0
  2276.                     .SetFocus
  2277.                     Call Lrsjhx
  2278.                     Coljsq = .Col - 1
  2279.                     Do While Coljsq > Qslz
  2280.                         If Coljsq - 1 = Qslz Then
  2281.                             If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  2282.                                 GoTo jzzx
  2283.                             End If
  2284.                         End If
  2285.                         If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  2286.                             Coljsq = Coljsq - 1
  2287.                         Else
  2288.                             Exit Do
  2289.                         End If
  2290.                     Loop
  2291.                     .Select .Row, Coljsq
  2292.                 End If
  2293. jzzx:
  2294.             Case vbKeyRight                 '右 箭 头 =39
  2295.                 wblong = Len(Ydtext.Text)
  2296.                 If (Ydtext.SelStart = wblong Or Ydtext.SelLength = wblong) Then
  2297.                     KeyCode = 0
  2298.                     .SetFocus
  2299.                     Call Lrsjhx
  2300.                     Rowjsq = .Row
  2301.                     Coljsq = .Col + 1
  2302.                     If Coljsq > .Cols - 1 Then
  2303.                         If Rowjsq < .Rows - 1 Then
  2304.                             Rowjsq = Rowjsq + 1
  2305.                         End If
  2306.                         Coljsq = Qslz
  2307.                     End If
  2308.                     Do While Rowjsq <= .Rows - 1
  2309.                         If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  2310.                             Coljsq = Coljsq + 1
  2311.                             If Coljsq > .Cols - 1 Then
  2312.                                 Rowjsq = Rowjsq + 1
  2313.                                 Coljsq = Qslz
  2314.                             End If
  2315.                         Else
  2316.                             Exit Do
  2317.                         End If
  2318.                     Loop
  2319.                     .Select Rowjsq, Coljsq
  2320.                 End If
  2321.             Case Else
  2322.         End Select
  2323.     End With
  2324. End Sub
  2325. Private Sub ydtext_KeyPress(KeyAscii As Integer)         '录入字符事中控制
  2326.     
  2327.     Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
  2328.     If KeyAscii <> 0 Then
  2329.         Call Xyxhbz(Dqlrwgh)
  2330.     End If
  2331. End Sub
  2332. Private Sub ydtext_Change()                              '录入事中变化处理
  2333.     '防止程序改变但不进行处理
  2334.     If Wbkbhlock Then
  2335.         Exit Sub
  2336.     End If
  2337.     With WglrGrid
  2338.         '限制字段录入长度
  2339.         Wbkbhlock = True
  2340.         Call TextChangeLimit(Ydtext, GridInt(.Col, 1))  '去掉无效字符
  2341.         Select Case GridInt(.Col, 1)
  2342.             Case 8, 11   '金额型
  2343.                 Call Sjgskz(Ydtext, Xtjezws - Xtjexsws - 1, Xtjexsws)
  2344.             Case 9, 12   '数量型
  2345.                 Call Sjgskz(Ydtext, Xtslzws - Xtslxsws - 1, Xtslxsws)
  2346.             Case 10      '单价型
  2347.                 Call Sjgskz(Ydtext, Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
  2348.             Case Else    '其他类型
  2349.                 If GridInt(.Col, 3) <> 0 Or GridInt(.Col, 4) <> 0 Then
  2350.                     Call Sjgskz(Ydtext, GridInt(.Col, 3), GridInt(.Col, 4))
  2351.                 End If
  2352.         End Select
  2353.         Wbkbhlock = False
  2354.     End With
  2355. End Sub
  2356. Private Sub ydtext_LostFocus()            '如果由于选中网格之外的控件而发生有效性判断(选中网格会先发生Rowcolchange事件置Valiock为TRUE)
  2357.   
  2358.     With WglrGrid
  2359.         If Not Valilock Then
  2360.             Call Lrsjhx
  2361.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  2362.                 Exit Sub
  2363.             End If
  2364.             If Not Sjhzyxxpd(Dqlrwgh) Then
  2365.                 Exit Sub
  2366.             End If
  2367.         End If
  2368.     End With
  2369. End Sub
  2370. Private Sub xswbk()                       '在当前选中单元显示文本框,列表框,帮助按钮(通用)
  2371.     
  2372.     Dim Wbkpy As Integer, Wbkpy1 As Integer '文本框偏移量
  2373.   
  2374.     '当某种条件成立时禁止文本框激活使单据处于录入状态
  2375.     If Not Fun_AllowInput Then
  2376.         Exit Sub
  2377.     End If
  2378.   
  2379.     '显示文本框前返回有效行列(解决滚动条问题)
  2380.     Call Xldqh
  2381.     Call Xldql
  2382.   
  2383.     '隐藏文本框,帮助按钮,列表组合框
  2384.     Call Ycwbk
  2385.   
  2386.     With WglrGrid
  2387.         Dqlrwgh = .Row
  2388.         Dqlrwgl = .Col
  2389.         If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  2390.             Exit Sub
  2391.         End If
  2392.      
  2393.         Wbkpy = 30
  2394.         Wbkpy1 = 15
  2395.         On Error Resume Next
  2396.         If GridBoolean(.Col, 3) Then
  2397.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  2398.             YdCombo.Top = .CellTop + .Top + Wbkpy
  2399.             YdCombo.Width = .CellWidth - Wbkpy1
  2400.             Call Wbkcl
  2401.             YdCombo.Visible = True
  2402.             YdCombo.SetFocus
  2403.             Ydcommand.Visible = False
  2404.             Ydtext.Visible = False
  2405.         Else
  2406.             If GridBoolean(.Col, 2) Then
  2407.                 Ydcommand.Left = .Left + .CellLeft + .CellWidth - Ydcommand.Width + Wbkpy
  2408.                 Ydcommand.Top = .Top + .CellTop + .CellHeight - Ydcommand.Height + Wbkpy
  2409.                 Ydcommand.Visible = True
  2410.             Else
  2411.                 Ydcommand.Visible = False
  2412.             End If
  2413.              
  2414.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  2415.             Ydtext.Top = .CellTop + .Top + Wbkpy
  2416.             If Ydcommand.Visible Then
  2417.                 If Sfblbzkd Then
  2418.                     Ydtext.Width = .CellWidth - Ydcommand.Width
  2419.                 Else
  2420.                     Ydtext.Width = .CellWidth - Wbkpy1
  2421.                 End If
  2422.             Else
  2423.                 Ydtext.Width = .CellWidth - Wbkpy1
  2424.             End If
  2425.             Ydtext.Height = .CellHeight - Wbkpy1
  2426.         
  2427.             If GridInt(.Col, 2) <> 0 Then
  2428.                 Ydtext.MaxLength = GridInt(.Col, 2)
  2429.             Else
  2430.                 Ydtext.MaxLength = 3000
  2431.             End If
  2432.       
  2433.             Call Wbkcl
  2434.       
  2435.             Ydtext.Visible = True
  2436.             Ydtext.SetFocus
  2437.         End If
  2438.         Dqtoprow = .TopRow
  2439.         Dqleftcol = .LeftCol
  2440.         
  2441.         '重置锁值
  2442.         Valilock = False
  2443.         Wbkbhlock = False
  2444.     End With
  2445. End Sub
  2446. Private Function Fun_AllowInput() As Boolean                           '当某种条件成立时禁止文本框激活使单据处于录入状态
  2447.    
  2448.     '如果单据操作状态为浏览状态则不能显示录入载体(通用)
  2449.     If Trim(Lab_OperStatus.Caption) = "1" Then
  2450.         Exit Function
  2451.     End If
  2452.    
  2453.     '[>>
  2454.     
  2455.     '此处可以填写禁止文本框激活使单据处于录入状态的理由
  2456.    
  2457.     '<<]
  2458.    
  2459.     Fun_AllowInput = True
  2460. End Function
  2461. Private Sub Cxxswbk()                                                  'Formresize中重新显示文本框,列表框,帮助按钮(通用)
  2462.                    
  2463.     Dim Wbkpy As Integer, Wbkpy1 As Integer
  2464.     Wbkpy = 30
  2465.     Wbkpy1 = 15
  2466.     With WglrGrid
  2467.         If YdCombo.Visible Then
  2468.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  2469.             YdCombo.Top = .CellTop + .Top + Wbkpy
  2470.             YdCombo.Width = .CellWidth - Wbkpy1
  2471.         End If
  2472.         If Ydcommand.Visible Then
  2473.             Ydcommand.Left = .Left + .CellLeft + .CellWidth - Ydcommand.Width + Wbkpy
  2474.             Ydcommand.Top = .Top + .CellTop + .CellHeight - Ydcommand.Height + Wbkpy
  2475.         End If
  2476.         If Ydtext.Visible Then
  2477.             If Ydcommand.Visible Then
  2478.                 If Sfblbzkd Then
  2479.                     Ydtext.Width = .CellWidth - Ydcommand.Width
  2480.                 Else
  2481.                     Ydtext.Width = .CellWidth - Wbkpy1
  2482.                 End If
  2483.             Else
  2484.                 Ydtext.Width = .CellWidth - Wbkpy1
  2485.             End If
  2486.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  2487.             Ydtext.Top = .CellTop + .Top + Wbkpy
  2488.             Ydtext.Height = .CellHeight - Wbkpy1
  2489.         End If
  2490.     End With
  2491. End Sub
  2492. Private Sub Lrsjhx()                                                   '文本框录入数据回写
  2493.     
  2494.     With WglrGrid
  2495.         If YdCombo.Visible Then
  2496.             .Text = Trim(YdCombo.Text)
  2497.         End If
  2498.         If Ydtext.Visible Then
  2499.             .Text = Trim(Ydtext.Text)
  2500.         End If
  2501.         
  2502.         '(如果字段录入内容发生变化,则打开有效性判断锁)
  2503.         If Zdlrqnr <> Trim(.Text) Then
  2504.             Yxxpdlock = False
  2505.             Hyxxpdlock = False
  2506.         End If
  2507.     
  2508.         '如果字段录入内容不为空则写数据行有效性标志
  2509.         If Len(Trim(.Text)) <> 0 Then
  2510.             Call Xyxhbz(.Row)
  2511.         End If
  2512.     
  2513.         '隐藏文本框,帮助按钮,列表组合框
  2514.         Call Ycwbk
  2515.     End With
  2516. End Sub
  2517. Private Sub WglrGrid_KeyDown(KeyCode As Integer, Shift As Integer)    '网格录入增行,删行快捷键
  2518.   
  2519.     '如果单据操作状态为浏览状态则不能显示录入载体
  2520.     If Trim(Lab_OperStatus.Caption) = "1" Then
  2521.         Exit Sub
  2522.     End If
  2523.     Select Case KeyCode
  2524.         Case vbKeyF2                   '按F2键参照
  2525.             Call xswbk
  2526.             Call Lrzdbz
  2527.         Case vbKeyDelete               '删行
  2528.             Call Scdqfl
  2529.         Case vbKeyInsert               '增行
  2530.             Call zjlrfl
  2531.     End Select
  2532. End Sub
  2533. Private Sub WglrGrid_KeyPress(KeyAscii As Integer)                             '网格接受键盘录入
  2534.     '当某种条件成立时禁止文本框激活使单据处于录入状态
  2535.     If Not Fun_AllowInput Then
  2536.         Exit Sub
  2537.     End If
  2538.   
  2539.     With WglrGrid
  2540.         '屏 蔽 回 车 键
  2541.         If KeyAscii = vbKeyReturn Then
  2542.             KeyAscii = 0
  2543.             Rowjsq = .Row
  2544.             Coljsq = .Col + 1
  2545.             If Coljsq > .Cols - 1 Then
  2546.                 If Rowjsq < .Rows - 1 Then
  2547.                     Rowjsq = Rowjsq + 1
  2548.                 End If
  2549.                 Coljsq = Qslz
  2550.             End If
  2551.             Do While Rowjsq <= .Rows - 1
  2552.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  2553.                     Coljsq = Coljsq + 1
  2554.                     If Coljsq > .Cols - 1 Then
  2555.                         Rowjsq = Rowjsq + 1
  2556.                         Coljsq = Qslz
  2557.                     End If
  2558.                 Else
  2559.                     Exit Do
  2560.                 End If
  2561.             Loop
  2562.             If Rowjsq <= .Rows - 1 Then
  2563.                 .Select Rowjsq, Coljsq
  2564.             End If
  2565.             Exit Sub
  2566.         End If
  2567.      
  2568.         '接受用户录入
  2569.         Select Case KeyAscii
  2570.             Case 0 To 32             '用户输入KeyAscii为0-32的键 如空格
  2571.                 '显示录入载体
  2572.                 Call xswbk
  2573.             Case Else
  2574.                 '防止非编辑字段SendKeys()出现死循环
  2575.                 If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  2576.                     Exit Sub
  2577.                 End If
  2578.                 '如果此字段为列表框录入则调入相应列表框
  2579.                 If GridBoolean(.Col, 3) Then
  2580.                     '列表框录入
  2581.                     Call xswbk
  2582.                 Else
  2583.                     Ydtext.Text = ""
  2584.                     '录入限制
  2585.                     Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
  2586.                     If KeyAscii = 0 Then
  2587.                         Exit Sub
  2588.                     End If
  2589.                     '如果录入字符有效则写有效行数据标志
  2590.                     Call Xyxhbz(.Row)
  2591.                     Call xswbk
  2592.                     Ydtext.Text = ""
  2593.                     Valilock = True
  2594.                     SendKeys Chr(KeyAscii), True
  2595.                     DoEvents
  2596.                     Valilock = False
  2597.                 End If
  2598.         End Select
  2599.     End With
  2600. End Sub
  2601. Private Sub zjlrfl()                                                    '增加录入分录
  2602.     
  2603.     With WglrGrid
  2604.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  2605.             If Not Fun_Drfrmyxxpd Then
  2606.                 Exit Sub
  2607.             End If
  2608.         Else
  2609.             Exit Sub
  2610.         End If
  2611.         If .Row < .FixedRows Then
  2612.             Exit Sub
  2613.         End If
  2614.         .AddItem "", .Row
  2615.         .RowHeight(.Row) = Sjhgd
  2616.         If .Row <> .Rows - 1 Then
  2617.             If .TextMatrix(.Row + 1, 0) = "*" Then
  2618.                 .TextMatrix(.Row, 0) = "*"
  2619.             Else
  2620.                 .RemoveItem .Rows - 1
  2621.             End If
  2622.         End If
  2623.         Call Xldqh
  2624.         Call Xldql
  2625.         Hyxxpdlock = False
  2626.     End With
  2627. End Sub
  2628. Private Sub Scdqfl()                                                    '删除当前分录
  2629.     Dim Answer As Integer, Scqwghz As Long, Scqwglz As Long, Hjlzte As Long, Sflrzt As Boolean
  2630.     With WglrGrid
  2631.         Scqwghz = .Row
  2632.         Scqwglz = .Col
  2633.         If .TextMatrix(.Row, 0) = "*" Then
  2634.             '判断是否为录入状态
  2635.             If Ydtext.Visible Or YdCombo.Visible Then
  2636.                 Sflrzt = True
  2637.                 Validate = True
  2638.                 Call Lrsjhx
  2639.                 Validate = False
  2640.             End If
  2641.             Call Xldqh
  2642.             Changelock = True
  2643.             .Select .Row, 0
  2644.             Changelock = False
  2645.             If Shsfts Then
  2646.                 .Cell(flexcpBackColor, .Row, Qslz, .Row, .Cols - 1) = QBColor(12)
  2647.                 Tsxx = "请确认是否删除当前记录?"
  2648.                 yhAnswer = Xtxxts(Tsxx, 2, 2)
  2649.                 If yhAnswer = 2 Then
  2650.                     .Cell(flexcpBackColor, .Row, Qslz, .Row, .Cols - 1) = &H80000005
  2651.                     Changelock = True
  2652.                     .Select Scqwghz, Scqwglz
  2653.                     Changelock = False
  2654.                     
  2655.                     '如为录入状态,则恢复录入
  2656.                     If Sflrzt Then
  2657.                         Call xswbk
  2658.                     End If
  2659.                     Exit Sub
  2660.                 End If
  2661.             End If
  2662.             .RemoveItem .Row
  2663.             If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  2664.                 .AddItem ""
  2665.                 .RowHeight(.Rows - 1) = Sjhgd
  2666.             End If
  2667.             Changelock = True
  2668.             .Select .Row, Scqwglz
  2669.             Changelock = False
  2670.    
  2671.             '重新计算合计数据
  2672.             For Hjlzte = Qslz To .Cols - 1
  2673.                 Call Sjhj(Hjlzte)
  2674.             Next Hjlzte
  2675.         End If
  2676.     End With
  2677. End Sub
  2678. Private Sub Sjhj(Hjwgl As Long)                                         '网格列数据合计
  2679.     
  2680.     Dim Hjjg As Double
  2681.     If Not GridBoolean(Hjwgl, 4) Then
  2682.         Exit Sub
  2683.     End If
  2684.     With WglrGrid
  2685.         Hjjg = 0
  2686.         For jsqte = .FixedRows To .Rows - 1
  2687.             If .TextMatrix(jsqte, 0) = "*" Then
  2688.                 Hjjg = Hjjg + S2N(.TextMatrix(jsqte, Hjwgl))
  2689.             End If
  2690.         Next jsqte
  2691.         If GridBoolean(Hjwgl, 5) And Hjjg = 0 Then
  2692.             HjGrid.TextMatrix(0, Hjwgl) = ""
  2693.         Else
  2694.             HjGrid.TextMatrix(0, Hjwgl) = Hjjg
  2695.         End If
  2696.     End With
  2697. End Sub
  2698. Private Sub Qkwlzd(sjh As Long, Sjl As Long)                            '清空为零字段
  2699.     
  2700.     If Not GridBoolean(Sjl, 5) Then
  2701.         Exit Sub
  2702.     End If
  2703.     With WglrGrid
  2704.         If S2N(Trim(.TextMatrix(sjh, Sjl))) = 0 Then
  2705.             .TextMatrix(sjh, Sjl) = ""
  2706.         End If
  2707.     End With
  2708. End Sub
  2709. Private Sub fhyxh()                                                     '返回录入数据有效行,同时让得到焦点网格可见
  2710.     
  2711.     With WglrGrid
  2712.         If .Row >= .FixedRows Then
  2713.             If .TextMatrix(.Row, 0) <> "*" Then
  2714.                 For Rowjsq = .FixedRows To .Rows - 1
  2715.                     If .TextMatrix(Rowjsq, 0) <> "*" Then
  2716.                         Exit For
  2717.                     End If
  2718.                 Next Rowjsq
  2719.                 If Rowjsq <= .Rows - 1 Then
  2720.                     Changelock = True
  2721.                     .Select Rowjsq, .Col
  2722.                     Changelock = False
  2723.                 Else
  2724.                     Changelock = True
  2725.                     .Select .Rows - 1, .Col
  2726.                     Changelock = False
  2727.                 End If
  2728.             End If
  2729.             Call Xldqh
  2730.         End If
  2731.   End With
  2732.   
  2733. End Sub
  2734. Private Sub Xldqh()                                                      '显露当前行
  2735.   
  2736.     Dim Toprowte As Long
  2737.     With WglrGrid
  2738.         Toprowte = 0
  2739.         Do While .CellTop + .RowHeight(.Row) + Fzxwghs * Sjhgd > .Height And .TopRow <> Toprowte
  2740.             Toprowte = .TopRow
  2741.             .TopRow = .TopRow + 1
  2742.         Loop
  2743.         Toprowte = 0
  2744.         Do While .CellTop < .FixedRows * .RowHeight(0) And .TopRow <> Toprowte
  2745.             Toprowte = .TopRow
  2746.             If .TopRow > 1 Then
  2747.                 .TopRow = .TopRow - 1
  2748.             End If
  2749.         Loop
  2750.     End With
  2751. End Sub
  2752. Private Sub Xldql()                                                     '显露当前列
  2753.     
  2754.     Dim Leftcolte As Long
  2755.     With WglrGrid
  2756.         If .Col >= Qslz And .Col >= .FixedCols Then
  2757.             If .LeftCol > .Col Then
  2758.                 .LeftCol = .Col
  2759.             End If
  2760.             Leftcolte = 0
  2761.             Do While .CellLeft + .CellWidth > .Width And .LeftCol <> Leftcolte
  2762.                 Leftcolte = .LeftCol
  2763.                 .LeftCol = .LeftCol + 1
  2764.             Loop
  2765.         End If
  2766.     End With
  2767. End Sub
  2768. Private Function pdhwk(sjh As Long)                                     '判断网格行是否为空行(所有录入字段均为空*非录入字段除外)
  2769.     
  2770.     With WglrGrid
  2771.         For Coljsq = Qslz To .Cols - 1
  2772.             If Len(Trim(.TextMatrix(sjh, Coljsq))) <> 0 And GridBoolean(Coljsq, 1) Then
  2773.                 pdhwk = False
  2774.                 Exit Function
  2775.             End If
  2776.         Next Coljsq
  2777.         pdhwk = True
  2778.     End With
  2779. End Function
  2780. Private Sub Xyxhbz(sjh As Long)                                         '写行有效性标志,并判断是否增行
  2781.     
  2782.     With WglrGrid
  2783.         If .TextMatrix(sjh, 0) = "*" Then
  2784.             Exit Sub
  2785.         End If
  2786.         .TextMatrix(sjh, 0) = "*"
  2787.         If sjh >= .Rows - Fzxwghs - 1 Then
  2788.             .AddItem ""
  2789.             .RowHeight(.Rows - 1) = Sjhgd
  2790.         End If
  2791.     End With
  2792. End Sub
  2793. '*****************************以下为文本框录入处理程序(固定不变部分)*******************************'
  2794. Private Sub Wbklrwbcl(Index As Integer)    '文本框录入事后处理程序
  2795.     '以下为依据实际情况自定义部分[
  2796.     
  2797.     '在此填写文本框录入事后处理程序
  2798.     
  2799.     ']以上为依据实际情况自定义部分
  2800. End Sub
  2801. Private Sub Ydcommand1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) '点击按钮
  2802.     
  2803. End Sub
  2804. Private Sub TextShow(Index As Integer)        '文本框得到焦点,显示相应信息
  2805.     '如果文本框有帮助,则显示帮助按钮
  2806.     If Textboolean(Index, 1) Then
  2807.         Ydcommand1.Visible = True
  2808.         
  2809.         Ydcommand1.Tag = Index
  2810.     Else
  2811.         Ydcommand1.Tag = ""
  2812.         Ydcommand1.Visible = False
  2813.     End If
  2814.     
  2815.     '[>>
  2816.     '可在此处定义其他处理动作
  2817.     '<<]
  2818. End Sub
  2819. Private Sub bbyl(bbylte As Boolean)                                     '打印预览(通用)
  2820.   Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  2821.   Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  2822.   Bbxbtgs = 1                                  '报 表 小 标 题 行 数
  2823.   Bbbwhgs = 1                                  '报 表 表 尾 行 数
  2824.   ReDim Bbxbt(1 To Bbxbtgs)
  2825.   ReDim bbxbtzzxs(1 To Bbxbtgs)
  2826.   If Bbbwhgs <> 0 Then
  2827.      ReDim Bbbwh(1 To Bbbwhgs)
  2828.      ReDim Bbbwhzzxs(1 To Bbbwhgs)
  2829.   End If
  2830.   Bbzbt = ReportTitle
  2831.    
  2832.   bbxbtzzxs(1) = 0                             '报表行组织形式(0-居左 1-居中 2-居右)
  2833.   Call Scyxsjb(WglrGrid)                       '生成报表数据
  2834.   Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  2835.   If Not bbylte Then
  2836.      Unload DY_Tybbyldy
  2837.   End If
  2838. End Sub
  2839. Public Property Get PFrmTlbOprState() As Variant
  2840.   PFrmTlbOprState = int_FrmState
  2841. End Property
  2842. Public Property Let PFrmTlbOprState(ByVal vNewValue As Variant)
  2843.   int_FrmState = vNewValue
  2844. End Property