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

企业管理

开发平台:

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 KF_FrmDBD 
  5.    BackColor       =   &H00E9F4FA&
  6.    BorderStyle     =   1  'Fixed Single
  7.    Caption         =   "调拨单"
  8.    ClientHeight    =   6120
  9.    ClientLeft      =   675
  10.    ClientTop       =   720
  11.    ClientWidth     =   11010
  12.    HelpContextID   =   1213007
  13.    Icon            =   "单据录入_调拨单.frx":0000
  14.    KeyPreview      =   -1  'True
  15.    LinkTopic       =   "Form4"
  16.    MaxButton       =   0   'False
  17.    MinButton       =   0   'False
  18.    ScaleHeight     =   6120
  19.    ScaleWidth      =   11010
  20.    StartUpPosition =   1  '所有者中心
  21.    Begin VB.TextBox LrText 
  22.       ForeColor       =   &H00000000&
  23.       Height          =   300
  24.       Index           =   0
  25.       Left            =   1020
  26.       TabIndex        =   0
  27.       Text            =   "0"
  28.       Top             =   1500
  29.       Width           =   1650
  30.    End
  31.    Begin MSComctlLib.Toolbar Tlb_Action 
  32.       Align           =   1  'Align Top
  33.       Height          =   555
  34.       Left            =   0
  35.       TabIndex        =   5
  36.       Top             =   0
  37.       Width           =   11010
  38.       _ExtentX        =   19420
  39.       _ExtentY        =   979
  40.       ButtonWidth     =   820
  41.       ButtonHeight    =   926
  42.       AllowCustomize  =   0   'False
  43.       Wrappable       =   0   'False
  44.       Appearance      =   1
  45.       Style           =   1
  46.       ImageList       =   "ImageList1"
  47.       _Version        =   393216
  48.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  49.          NumButtons      =   23
  50.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  51.             Caption         =   "打印"
  52.             Key             =   "dy"
  53.             Object.ToolTipText     =   "打印当前单据或Ctrl+P"
  54.             ImageKey        =   "dy"
  55.          EndProperty
  56.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  57.             Caption         =   "预览"
  58.             Key             =   "yl"
  59.             ImageKey        =   "yl"
  60.          EndProperty
  61.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  62.             Key             =   "fgh0"
  63.             Style           =   3
  64.          EndProperty
  65.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  66.             Caption         =   "新增"
  67.             Key             =   "xz"
  68.             Object.ToolTipText     =   "新增加一张单据或F5"
  69.             ImageKey        =   "xz"
  70.          EndProperty
  71.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  72.             Caption         =   "修改"
  73.             Key             =   "xg"
  74.             Object.ToolTipText     =   "修改当前单据或F3"
  75.             ImageKey        =   "xg"
  76.          EndProperty
  77.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  78.             Caption         =   "删除"
  79.             Key             =   "sc"
  80.             Object.ToolTipText     =   "删除当前单据"
  81.             ImageKey        =   "sc"
  82.          EndProperty
  83.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  84.             Key             =   "fgh1"
  85.             Style           =   3
  86.          EndProperty
  87.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  88.             Caption         =   "增行"
  89.             Key             =   "zh"
  90.             Object.ToolTipText     =   "插入一行或Insert"
  91.             ImageKey        =   "zh"
  92.          EndProperty
  93.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  94.             Caption         =   "删行"
  95.             Key             =   "sh"
  96.             Object.ToolTipText     =   "删除当前记录行或Delete"
  97.             ImageKey        =   "sh"
  98.          EndProperty
  99.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  100.             Key             =   "fgh2"
  101.             Style           =   3
  102.          EndProperty
  103.          BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  104.             Caption         =   "保存"
  105.             Key             =   "bc"
  106.             Object.ToolTipText     =   "保存单据或F6"
  107.             ImageKey        =   "bc"
  108.          EndProperty
  109.          BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  110.             Caption         =   "放弃"
  111.             Key             =   "fq"
  112.             Object.ToolTipText     =   "放弃此次操作"
  113.             ImageKey        =   "fq"
  114.          EndProperty
  115.          BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  116.             Key             =   "fgh3"
  117.             Style           =   3
  118.          EndProperty
  119.          BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  120.             Caption         =   "审核"
  121.             Key             =   "shsh"
  122.             ImageKey        =   "check"
  123.          EndProperty
  124.          BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  125.             Caption         =   "弃审"
  126.             Key             =   "shqs"
  127.             ImageKey        =   "qs"
  128.          EndProperty
  129.          BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  130.             Key             =   "fgh4"
  131.             Style           =   3
  132.          EndProperty
  133.          BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  134.             Caption         =   "首张"
  135.             Key             =   "first"
  136.             ImageKey        =   "first"
  137.          EndProperty
  138.          BeginProperty Button18 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  139.             Caption         =   "上张"
  140.             Key             =   "prev"
  141.             ImageKey        =   "prev"
  142.          EndProperty
  143.          BeginProperty Button19 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  144.             Caption         =   "下张"
  145.             Key             =   "next"
  146.             ImageKey        =   "next"
  147.          EndProperty
  148.          BeginProperty Button20 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  149.             Caption         =   "末张"
  150.             Key             =   "last"
  151.             ImageKey        =   "last"
  152.          EndProperty
  153.          BeginProperty Button21 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  154.             Key             =   "fgh5"
  155.             Style           =   3
  156.          EndProperty
  157.          BeginProperty Button22 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  158.             Caption         =   "帮助"
  159.             Key             =   "bz"
  160.             ImageKey        =   "bz"
  161.          EndProperty
  162.          BeginProperty Button23 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  163.             Caption         =   "退出"
  164.             Key             =   "fh"
  165.             ImageKey        =   "tc"
  166.          EndProperty
  167.       EndProperty
  168.       BorderStyle     =   1
  169.    End
  170.    Begin VB.CommandButton Ydcommand 
  171.       Height          =   300
  172.       Left            =   10680
  173.       Picture         =   "单据录入_调拨单.frx":1042
  174.       Style           =   1  'Graphical
  175.       TabIndex        =   4
  176.       Top             =   990
  177.       Visible         =   0   'False
  178.       Width           =   300
  179.    End
  180.    Begin VB.TextBox Ydtext 
  181.       BackColor       =   &H80000018&
  182.       BorderStyle     =   0  'None
  183.       Height          =   330
  184.       Left            =   7710
  185.       MultiLine       =   -1  'True
  186.       TabIndex        =   2
  187.       Top             =   960
  188.       Visible         =   0   'False
  189.       Width           =   1185
  190.    End
  191.    Begin VB.Timer Timer1 
  192.       Interval        =   1
  193.       Left            =   9690
  194.       Top             =   150
  195.    End
  196.    Begin VB.CommandButton Ydcommand1 
  197.       Height          =   300
  198.       Left            =   10680
  199.       Picture         =   "单据录入_调拨单.frx":13CC
  200.       Style           =   1  'Graphical
  201.       TabIndex        =   9
  202.       Top             =   600
  203.       Visible         =   0   'False
  204.       Width           =   300
  205.    End
  206.    Begin VB.ComboBox YdCombo 
  207.       Height          =   300
  208.       Left            =   9000
  209.       Style           =   2  'Dropdown List
  210.       TabIndex        =   3
  211.       Top             =   960
  212.       Visible         =   0   'False
  213.       Width           =   1155
  214.    End
  215.    Begin MSComctlLib.ImageList ImageList1 
  216.       Left            =   10410
  217.       Top             =   1350
  218.       _ExtentX        =   1005
  219.       _ExtentY        =   1005
  220.       BackColor       =   -2147483643
  221.       ImageWidth      =   16
  222.       ImageHeight     =   16
  223.       MaskColor       =   12632256
  224.       _Version        =   393216
  225.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  226.          NumListImages   =   37
  227.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  228.             Picture         =   "单据录入_调拨单.frx":1756
  229.             Key             =   "sz"
  230.          EndProperty
  231.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  232.             Picture         =   "单据录入_调拨单.frx":1AF0
  233.             Key             =   "dy"
  234.          EndProperty
  235.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  236.             Picture         =   "单据录入_调拨单.frx":1E8A
  237.             Key             =   "yl"
  238.          EndProperty
  239.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  240.             Picture         =   "单据录入_调拨单.frx":2224
  241.             Key             =   "xg"
  242.          EndProperty
  243.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  244.             Picture         =   "单据录入_调拨单.frx":25BE
  245.             Key             =   "zh"
  246.          EndProperty
  247.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  248.             Picture         =   "单据录入_调拨单.frx":2958
  249.             Key             =   "sh"
  250.          EndProperty
  251.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  252.             Picture         =   "单据录入_调拨单.frx":2CF2
  253.             Key             =   "bc"
  254.          EndProperty
  255.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  256.             Picture         =   "单据录入_调拨单.frx":308C
  257.             Key             =   "fq"
  258.          EndProperty
  259.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  260.             Picture         =   "单据录入_调拨单.frx":3426
  261.             Key             =   "bz"
  262.          EndProperty
  263.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  264.             Picture         =   "单据录入_调拨单.frx":37C0
  265.             Key             =   "tc"
  266.          EndProperty
  267.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  268.             Picture         =   "单据录入_调拨单.frx":3B5A
  269.             Key             =   "bcgs"
  270.          EndProperty
  271.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  272.             Picture         =   "单据录入_调拨单.frx":3EF4
  273.             Key             =   "mrlk"
  274.          EndProperty
  275.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  276.             Picture         =   "单据录入_调拨单.frx":428E
  277.             Key             =   "xsxm"
  278.          EndProperty
  279.          BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  280.             Picture         =   "单据录入_调拨单.frx":4628
  281.             Key             =   "first"
  282.          EndProperty
  283.          BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  284.             Picture         =   "单据录入_调拨单.frx":49C2
  285.             Key             =   "prev"
  286.          EndProperty
  287.          BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  288.             Picture         =   "单据录入_调拨单.frx":4D5C
  289.             Key             =   "next"
  290.          EndProperty
  291.          BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  292.             Picture         =   "单据录入_调拨单.frx":50F6
  293.             Key             =   "last"
  294.          EndProperty
  295.          BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  296.             Picture         =   "单据录入_调拨单.frx":5490
  297.             Key             =   "xx"
  298.          EndProperty
  299.          BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  300.             Picture         =   "单据录入_调拨单.frx":582A
  301.             Key             =   "define"
  302.          EndProperty
  303.          BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  304.             Picture         =   "单据录入_调拨单.frx":5BC4
  305.             Key             =   "exec"
  306.          EndProperty
  307.          BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  308.             Picture         =   "单据录入_调拨单.frx":5F5E
  309.             Key             =   "xz"
  310.          EndProperty
  311.          BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  312.             Picture         =   "单据录入_调拨单.frx":62F8
  313.             Key             =   "sc"
  314.          EndProperty
  315.          BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  316.             Picture         =   "单据录入_调拨单.frx":6692
  317.             Key             =   "sx"
  318.          EndProperty
  319.          BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  320.             Picture         =   "单据录入_调拨单.frx":6A2C
  321.             Key             =   "cx"
  322.          EndProperty
  323.          BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  324.             Picture         =   "单据录入_调拨单.frx":6DC6
  325.             Key             =   "zd"
  326.          EndProperty
  327.          BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  328.             Picture         =   "单据录入_调拨单.frx":7160
  329.             Key             =   "dz"
  330.          EndProperty
  331.          BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  332.             Picture         =   "单据录入_调拨单.frx":74FA
  333.             Key             =   "ph"
  334.          EndProperty
  335.          BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  336.             Picture         =   "单据录入_调拨单.frx":7894
  337.             Key             =   "fz"
  338.          EndProperty
  339.          BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  340.             Picture         =   "单据录入_调拨单.frx":7C2E
  341.             Key             =   "dw"
  342.          EndProperty
  343.          BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  344.             Picture         =   "单据录入_调拨单.frx":7FC8
  345.             Key             =   "hf"
  346.          EndProperty
  347.          BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  348.             Picture         =   "单据录入_调拨单.frx":8362
  349.             Key             =   "pz"
  350.          EndProperty
  351.          BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  352.             Picture         =   "单据录入_调拨单.frx":86FC
  353.             Key             =   "check"
  354.          EndProperty
  355.          BeginProperty ListImage33 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  356.             Picture         =   "单据录入_调拨单.frx":8A96
  357.             Key             =   "qs"
  358.          EndProperty
  359.          BeginProperty ListImage34 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  360.             Picture         =   "单据录入_调拨单.frx":8E30
  361.             Key             =   "fullcheck"
  362.          EndProperty
  363.          BeginProperty ListImage35 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  364.             Picture         =   "单据录入_调拨单.frx":91CA
  365.             Key             =   "qq"
  366.          EndProperty
  367.          BeginProperty ListImage36 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  368.             Picture         =   "单据录入_调拨单.frx":9564
  369.             Key             =   "bcw"
  370.          EndProperty
  371.          BeginProperty ListImage37 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  372.             Picture         =   "单据录入_调拨单.frx":98FE
  373.             Key             =   "ye"
  374.          EndProperty
  375.       EndProperty
  376.    End
  377.    Begin VSFlex8Ctl.VSFlexGrid WglrGrid 
  378.       Height          =   3345
  379.       Left            =   120
  380.       TabIndex        =   1
  381.       Top             =   2280
  382.       Width           =   10680
  383.       _cx             =   5080
  384.       _cy             =   5080
  385.       Appearance      =   1
  386.       BorderStyle     =   1
  387.       Enabled         =   -1  'True
  388.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  389.          Name            =   "宋体"
  390.          Size            =   9
  391.          Charset         =   134
  392.          Weight          =   400
  393.          Underline       =   0   'False
  394.          Italic          =   0   'False
  395.          Strikethrough   =   0   'False
  396.       EndProperty
  397.       MousePointer    =   0
  398.       BackColor       =   16777215
  399.       ForeColor       =   -2147483640
  400.       BackColorFixed  =   12640511
  401.       ForeColorFixed  =   -2147483630
  402.       BackColorSel    =   -2147483643
  403.       ForeColorSel    =   -2147483640
  404.       BackColorBkg    =   16777215
  405.       BackColorAlternate=   16777215
  406.       GridColor       =   -2147483633
  407.       GridColorFixed  =   -2147483632
  408.       TreeColor       =   -2147483632
  409.       FloodColor      =   192
  410.       SheetBorder     =   -2147483642
  411.       FocusRect       =   1
  412.       HighLight       =   1
  413.       AllowSelection  =   0   'False
  414.       AllowBigSelection=   0   'False
  415.       AllowUserResizing=   0
  416.       SelectionMode   =   0
  417.       GridLines       =   1
  418.       GridLinesFixed  =   2
  419.       GridLineWidth   =   1
  420.       Rows            =   5000
  421.       Cols            =   10
  422.       FixedRows       =   1
  423.       FixedCols       =   0
  424.       RowHeightMin    =   0
  425.       RowHeightMax    =   0
  426.       ColWidthMin     =   0
  427.       ColWidthMax     =   0
  428.       ExtendLastCol   =   0   'False
  429.       FormatString    =   ""
  430.       ScrollTrack     =   0   'False
  431.       ScrollBars      =   3
  432.       ScrollTips      =   0   'False
  433.       MergeCells      =   0
  434.       MergeCompare    =   0
  435.       AutoResize      =   -1  'True
  436.       AutoSizeMode    =   0
  437.       AutoSearch      =   0
  438.       AutoSearchDelay =   2
  439.       MultiTotals     =   -1  'True
  440.       SubtotalPosition=   1
  441.       OutlineBar      =   0
  442.       OutlineCol      =   0
  443.       Ellipsis        =   0
  444.       ExplorerBar     =   0
  445.       PicturesOver    =   0   'False
  446.       FillStyle       =   0
  447.       RightToLeft     =   0   'False
  448.       PictureType     =   0
  449.       TabBehavior     =   0
  450.       OwnerDraw       =   0
  451.       Editable        =   0
  452.       ShowComboButton =   1
  453.       WordWrap        =   -1  'True
  454.       TextStyle       =   0
  455.       TextStyleFixed  =   0
  456.       OleDragMode     =   0
  457.       OleDropMode     =   0
  458.       DataMode        =   0
  459.       VirtualData     =   -1  'True
  460.       DataMember      =   ""
  461.       ComboSearch     =   3
  462.       AutoSizeMouse   =   -1  'True
  463.       FrozenRows      =   0
  464.       FrozenCols      =   0
  465.       AllowUserFreezing=   0
  466.       BackColorFrozen =   0
  467.       ForeColorFrozen =   0
  468.       WallPaperAlignment=   9
  469.       AccessibleName  =   ""
  470.       AccessibleDescription=   ""
  471.       AccessibleValue =   ""
  472.       AccessibleRole  =   24
  473.       Begin VSFlex8Ctl.VSFlexGrid HjGrid 
  474.          Height          =   885
  475.          Left            =   0
  476.          TabIndex        =   14
  477.          Top             =   2400
  478.          Width           =   7545
  479.          _cx             =   5080
  480.          _cy             =   5080
  481.          Appearance      =   1
  482.          BorderStyle     =   0
  483.          Enabled         =   -1  'True
  484.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  485.             Name            =   "宋体"
  486.             Size            =   9
  487.             Charset         =   134
  488.             Weight          =   400
  489.             Underline       =   0   'False
  490.             Italic          =   0   'False
  491.             Strikethrough   =   0   'False
  492.          EndProperty
  493.          MousePointer    =   0
  494.          BackColor       =   14671839
  495.          ForeColor       =   -2147483640
  496.          BackColorFixed  =   -2147483633
  497.          ForeColorFixed  =   -2147483630
  498.          BackColorSel    =   -2147483643
  499.          ForeColorSel    =   -2147483640
  500.          BackColorBkg    =   16777215
  501.          BackColorAlternate=   14671839
  502.          GridColor       =   -2147483633
  503.          GridColorFixed  =   -2147483632
  504.          TreeColor       =   -2147483632
  505.          FloodColor      =   192
  506.          SheetBorder     =   -2147483642
  507.          FocusRect       =   1
  508.          HighLight       =   1
  509.          AllowSelection  =   0   'False
  510.          AllowBigSelection=   0   'False
  511.          AllowUserResizing=   0
  512.          SelectionMode   =   0
  513.          GridLines       =   1
  514.          GridLinesFixed  =   2
  515.          GridLineWidth   =   1
  516.          Rows            =   5000
  517.          Cols            =   10
  518.          FixedRows       =   1
  519.          FixedCols       =   0
  520.          RowHeightMin    =   0
  521.          RowHeightMax    =   0
  522.          ColWidthMin     =   0
  523.          ColWidthMax     =   0
  524.          ExtendLastCol   =   0   'False
  525.          FormatString    =   ""
  526.          ScrollTrack     =   0   'False
  527.          ScrollBars      =   3
  528.          ScrollTips      =   0   'False
  529.          MergeCells      =   0
  530.          MergeCompare    =   0
  531.          AutoResize      =   -1  'True
  532.          AutoSizeMode    =   0
  533.          AutoSearch      =   0
  534.          AutoSearchDelay =   2
  535.          MultiTotals     =   -1  'True
  536.          SubtotalPosition=   1
  537.          OutlineBar      =   0
  538.          OutlineCol      =   0
  539.          Ellipsis        =   0
  540.          ExplorerBar     =   0
  541.          PicturesOver    =   0   'False
  542.          FillStyle       =   0
  543.          RightToLeft     =   0   'False
  544.          PictureType     =   0
  545.          TabBehavior     =   0
  546.          OwnerDraw       =   0
  547.          Editable        =   0
  548.          ShowComboButton =   1
  549.          WordWrap        =   -1  'True
  550.          TextStyle       =   0
  551.          TextStyleFixed  =   0
  552.          OleDragMode     =   0
  553.          OleDropMode     =   0
  554.          DataMode        =   0
  555.          VirtualData     =   -1  'True
  556.          DataMember      =   ""
  557.          ComboSearch     =   3
  558.          AutoSizeMouse   =   -1  'True
  559.          FrozenRows      =   0
  560.          FrozenCols      =   0
  561.          AllowUserFreezing=   0
  562.          BackColorFrozen =   0
  563.          ForeColorFrozen =   0
  564.          WallPaperAlignment=   9
  565.          AccessibleName  =   ""
  566.          AccessibleDescription=   ""
  567.          AccessibleValue =   ""
  568.          AccessibleRole  =   24
  569.       End
  570.    End
  571.    Begin VB.Label Lab_Title 
  572.       AutoSize        =   -1  'True
  573.       BackColor       =   &H80000018&
  574.       BackStyle       =   0  'Transparent
  575.       Caption         =   "单据标题自动调整"
  576.       BeginProperty Font 
  577.          Name            =   "宋体"
  578.          Size            =   15
  579.          Charset         =   134
  580.          Weight          =   700
  581.          Underline       =   0   'False
  582.          Italic          =   0   'False
  583.          Strikethrough   =   0   'False
  584.       EndProperty
  585.       ForeColor       =   &H00000000&
  586.       Height          =   300
  587.       Left            =   4440
  588.       TabIndex        =   13
  589.       Top             =   840
  590.       Width           =   2520
  591.    End
  592.    Begin VB.Label Lab_BillId 
  593.       AutoSize        =   -1  'True
  594.       BackColor       =   &H0080C0FF&
  595.       Height          =   270
  596.       Left            =   7680
  597.       TabIndex        =   12
  598.       Top             =   600
  599.       Visible         =   0   'False
  600.       Width           =   2490
  601.    End
  602.    Begin VB.Label Lab_Djclzt 
  603.       BackColor       =   &H0000FFFF&
  604.       Caption         =   "1"
  605.       ForeColor       =   &H00808080&
  606.       Height          =   255
  607.       Left            =   10320
  608.       TabIndex        =   11
  609.       Top             =   600
  610.       Visible         =   0   'False
  611.       Width           =   285
  612.    End
  613.    Begin VB.Label Lab_OperStatus 
  614.       BackColor       =   &H000080FF&
  615.       Caption         =   "1"
  616.       Height          =   345
  617.       Left            =   10290
  618.       TabIndex        =   10
  619.       Top             =   960
  620.       Visible         =   0   'False
  621.       Width           =   345
  622.    End
  623.    Begin VB.Label Lab_Bill 
  624.       Appearance      =   0  'Flat
  625.       BackColor       =   &H80000005&
  626.       BackStyle       =   0  'Transparent
  627.       ForeColor       =   &H00000000&
  628.       Height          =   225
  629.       Left            =   9030
  630.       TabIndex        =   8
  631.       Top             =   6330
  632.       Width           =   735
  633.    End
  634.    Begin VB.Label Lab_Checker 
  635.       Appearance      =   0  'Flat
  636.       BackColor       =   &H80000005&
  637.       BackStyle       =   0  'Transparent
  638.       ForeColor       =   &H00000000&
  639.       Height          =   225
  640.       Left            =   7170
  641.       TabIndex        =   7
  642.       Top             =   6360
  643.       Width           =   735
  644.    End
  645.    Begin VB.Label TsLabel 
  646.       Alignment       =   1  'Right Justify
  647.       AutoSize        =   -1  'True
  648.       BackStyle       =   0  'Transparent
  649.       Caption         =   "单据号:"
  650.       Height          =   180
  651.       Index           =   0
  652.       Left            =   240
  653.       TabIndex        =   6
  654.       Top             =   1560
  655.       Width           =   765
  656.    End
  657. End
  658. Attribute VB_Name = "KF_FrmDBD"
  659. Attribute VB_GlobalNameSpace = False
  660. Attribute VB_Creatable = False
  661. Attribute VB_PredeclaredId = True
  662. Attribute VB_Exposed = False
  663. '***********************************************************************************************************
  664. '*    模 块 名 称 :调拨单处理
  665. '*    功 能 描 述 :此功能模块主要完成单据录入、修改、删除、预览打印等。
  666. '*    程序员姓名  :张万成
  667. '*    最后修改人  :张万成
  668. '*    最后修改时间:2001/11/28
  669. '*    备        注:程序中所有依实际情况自定义部分均用[>>  <<]括起
  670. '*
  671. '*    1.每次调入外部功能窗体,均要加锁ChangeLock=True,窗体关闭后解锁ChangeLock=false
  672. '*                                    TextValiLock=True             TextValiLock=false
  673. '*
  674. '*    2.Lab_OperStatus 用此标签来标识单据录入状态(默认值为1) "1"-浏览 "2"-新增 "3"-修改
  675. '*
  676. '*    3.Lab_Djclzt 用此标签来标识单据处理状态(默认值为1) "1"-填制单据  "2"-查询单据列表  "3"-明细帐联查单据
  677. '*
  678. '*    4.原则:只要单据能够存盘(无论修改或新增)则其必须接受完整性及有效性规则检查
  679. '***********************************************************************************************************
  680.  
  681. '[以下为根据实际情况设置变量
  682. Dim Bln_BillChange As Boolean                   '标识单据是否发生改动
  683. Dim Rec_Query As New ADODB.Recordset            '单据组查询结果动态集(保存当前单据组ID)
  684. Public Str_QueryCondi As String                 '单据组查询条件(接收单据列表传递查询条件)
  685. ']
  686. '以下为固定使用变量(单据)
  687. Dim BillCode As String                          '单据设计编码(索引号)
  688. Dim Var_Bill() As Variant                       '用来返回单据设计信息
  689. Dim ReportTitle As String                       '报表主标题
  690. Dim Tsxx As String                              '系统提示信息
  691. '以下为固定使用变量(网格)
  692. Dim Cxnrrec As New ADODB.Recordset              '显示查询内容动态集
  693. Dim Dyymctbl As New DY_Dyymsz                   '打印页面窗体变量
  694. Dim GridCode As String                          '显示网格网格代码
  695. Dim GridInf() As Variant                        '整个网格设置信息
  696. Dim Pmbcsjhs As Long                            '屏幕网格保持数据行数(大于等于1)
  697. Dim Fzxwghs As Integer                          '辅助项网格行数(包括合计行)
  698. Dim Sfxshjwg As Boolean                         '是否显示合计网格
  699. Dim Qslz As Long                                '网格隐藏(非操作显示)列数
  700. Dim Sjhgd As Double                             '网格数据行高度
  701. Dim GridBoolean() As Boolean                    '网格列信息(布尔型)
  702. Dim GridStr()  As String                        '网格列信息(字符型)
  703. Dim GridInt() As Integer                        '网格列信息(整型)
  704. Dim Sfblbzkd As Boolean                         '是否保留帮助宽度(字段提供帮助时,是否为按钮保留空间)
  705. Dim Dqlrwgh As Long                             '当前录入数据网格行
  706. Dim Dqlrwgl As Long                             '当前录入数据网格列
  707. Dim Dqlkwgh As Long                             '刚刚离开网格行(不一定为录入行)
  708. Dim Dqlkwgl As Long                             '刚刚离开网格列
  709. Dim Dqtoprow As Long                            '当前录入状态时最上端可视行
  710. Dim Dqleftcol As Long                           '当前录入状态时最左端可视列
  711. Dim Zdlrqnr As String                           '字段录入修改前内容(用来判断内容是否修改)
  712. Dim Wbkbhlock As Boolean                        '文本框改变值锁
  713. Dim Changelock As Boolean                       '网格行列改变控制锁(用来区别用户改变.程序改变)
  714. Dim Gdtlock As Boolean                          '滚动条滚动控制(用来区别用户改变.程序改变)
  715. Dim Yxxpdlock As Boolean                        '字段有效性判断锁(内容不修改不需进行字段有效性判断)
  716. Dim Hyxxpdlock As Boolean                       '行有效性判断锁(字段内容不修改不需进行行有效性判断)
  717. Dim Valilock As Boolean                         '文本框失去焦点是否进行有效性控制(TRUE 为锁定*限用网格录入)
  718. Dim Shsfts As Boolean                           '删除记录行是否提示
  719. Dim Szzls As Integer                            '网格信息数组最大下标值(网格列数-1)
  720. Dim intFatherID() As Integer
  721. Dim intChildID() As Integer
  722. Dim IsQc() As Boolean
  723. Dim intCount As Integer
  724. '以下为固定使用变量(文本框)
  725. Dim Textvar() As Variant                        '存储变体型文本框信息
  726. Dim Textboolean() As Boolean                    '存储布尔型文本框信息
  727. Dim Textint() As Integer                        '存储整型文本框信息
  728. Dim Textstr() As String                         '存储字符型文本框信息
  729. Dim Max_Text_Index As Integer                   '最大录入文本框索引值
  730. Dim TextGroupCode As String                     '文本框录入分组编码
  731. Dim TextValiLock As Boolean                     '文本框失去焦点是否进行有效性控制判断
  732. Dim TextValiJudgeLock() As Boolean              '文本框录入有效性判断控制锁
  733. Dim TextChangeLock As Boolean                   '文本框内容变换控制锁
  734. Dim PriceMode As String
  735. Dim InID As Integer                             '入库单ID
  736. Dim OutID As Integer                            '出库单ID
  737. Dim Str_RightEdit As String                     '单据编辑(新增、修改、删除)权限索引
  738. Dim Str_RightCheck As String                    '单据审核(审核、弃审)权限索引
  739.    
  740. Private Sub Form_KeyPress(KeyAscii As Integer)      '控 制 焦 点 转 移
  741.     
  742.     Dim jdzygs As Integer
  743.     jdzygs = 11                                       '在单据录入中,此焦点转移控制值一定小于等于文本框个数,否则网格回车键将不支持.
  744.     Select Case KeyAscii
  745.         Case vbKeyReturn
  746.             If Kjjdzy(jdzygs) Then
  747.                 KeyAscii = 0
  748.             End If
  749.         Case 39           '屏蔽字符"'"
  750.             KeyAscii = 0
  751.     End Select
  752. End Sub
  753. Private Sub Form_Load()                                                        '窗 体 装 入
  754.     '初始化各种锁值(Fixed)
  755.     Changelock = False             '网格行列改变控制锁
  756.     Gdtlock = False                '滚动条滚动控制
  757.     Yxxpdlock = True               '字段有效性判断锁
  758.     Hyxxpdlock = True              '行有效性判断锁
  759.     Wbkbhlock = False              '文本框内容改变锁
  760.     
  761.     '单据权限索引设置
  762.     Str_RightEdit = "Kf_DBD_edit"
  763.     Str_RightCheck = "Kf_DBD_check"
  764.     
  765.     '调入单据信息(需要修改BillCode)
  766.     BillCode = "1207"
  767.     Call Sub_ReadBillInfo(BillCode, Me, Var_Bill())
  768.     Lab_Title = Var_Bill(2)
  769.     Lab_Title.Move (Me.Width - Lab_Title.Width) / 2, 800
  770.     
  771.     '报表编码
  772.     XtReportCode = Var_Bill(5)
  773.     Load Dyymctbl
  774.   
  775.     '以下为文本框处理程序(Fixed)
  776.     TextGroupCode = Var_Bill(3)
  777.  
  778.     Call Drwbkxx(TextGroupCode, Textvar(), Textboolean(), Textint(), Textstr())  '读入文本框录入信息
  779.     Call Wbkcsh
  780.   
  781.     '调入网格并记录一些网格信息(Fixed)
  782.     GridCode = Var_Bill(4)         '网格属性编码
  783.     Call BzWgcsh(WglrGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  784.       
  785.     Qslz = GridInf(1)
  786.     Sjhgd = GridInf(2)
  787.     Fzxwghs = GridInf(4)
  788.     Sfblbzkd = GridInf(5)
  789.     Shsfts = GridInf(6)
  790.     Sfxshjwg = GridInf(7)
  791.     Szzls = WglrGrid.Cols - 1
  792.     Pmbcsjhs = Int((WglrGrid.Height - WglrGrid.FixedRows * WglrGrid.RowHeight(0)) / Sjhgd) - Fzxwghs - 1
  793.       
  794.     For jsqte = WglrGrid.FixedRows To WglrGrid.Rows - 1
  795.         WglrGrid.RowHeight(jsqte) = Sjhgd
  796.     Next jsqte
  797.     
  798.     '初始化合计网格(Fixed)
  799.     Call VisulGrid
  800.     Call Cshhjwg
  801.   
  802.     '单据变动置为False(Fixed)
  803.     Bln_BillChange = False
  804.     
  805.     '调入数据初始化模块(Fixed)
  806.     Lab_Djclzt.Caption = Xtcdcs
  807.     Call Sjcsh(Trim(Lab_Djclzt.Caption))
  808.    
  809. End Sub
  810. Private Sub Form_Unload(Cancel As Integer)           '窗体卸载
  811. '是否保存已修改单据
  812.     Dim YAnswer As Integer
  813.     If Lab_OperStatus.Caption = "2" Or Lab_OperStatus.Caption = "3" Then
  814.         Tsxx = "单据尚未保存,是否退出?"
  815.         YAnswer = Xtxxts(Tsxx, 2, 2)
  816.         If YAnswer <> 1 Then
  817.             Cancel = 1
  818.             Exit Sub
  819.         End If
  820.     End If
  821.     '卸载打印页面窗体
  822.     Unload Dyymctbl
  823.  
  824.     '判断单据是否发生变化,并返回相应标识
  825.     If Bln_BillChange Then
  826.         Xtfhcs = "1"
  827.     Else
  828.         Xtfhcs = "0"
  829.     End If
  830.    
  831. End Sub
  832. Private Sub Sjcsh(Str_Pzclzt As String)              '数据初始化模块(根据实际情况)
  833.     
  834.     Dim Sqlstr As String       '查询单据列表条件
  835.     '[>>根据实际情况初始化
  836.     Select Case Str_Pzclzt
  837.         Case "1"   '填制单据
  838.             '调入用户查询结果动态集(默认显示用户当前操作业务日期的单据)
  839.             Sqlstr = "SELECT MoveMainID From KF_MoveMain Where BillDate='" & Xtrq & "' ORDER BY MoveMainID "
  840.             Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  841.       
  842.             '新增单据
  843.             Call Sub_AddBill
  844.         Case "2"   '查询单据(单据列表)
  845.         
  846.             '填充查询单据标识
  847.             Lab_BillId.Caption = XT_BillID
  848.             Str_QueryCondi = Xtcdcsfz
  849.                 
  850.             Call Sub_ShowBill
  851.             Call Sub_OperStatus("10")
  852.       
  853.             '调入用户查询结果动态集
  854.             Sqlstr = "SELECT DISTINCT MoveMainID From KF_V_DBD a " & Str_QueryCondi & " ORDER BY MoveMainID"
  855.             Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  856.             Rec_Query.Find "MoveMainID=" & Val(Lab_BillId.Caption)
  857.         Case "3"   '明细帐联查单据
  858.             '设置工具条显示
  859.             With Tlb_Action
  860.                 .Buttons("xz").Enabled = False             '新增
  861.                 .Buttons("xg").Enabled = False             '修改
  862.                 .Buttons("sc").Enabled = False             '删除
  863.                 .Buttons("fgh0").Enabled = False           '分隔行
  864.                 .Buttons("zh").Enabled = False             '增行
  865.                 .Buttons("sh").Enabled = False             '删行
  866.                 .Buttons("fgh1").Enabled = False           '分隔行
  867.                 .Buttons("bc").Enabled = False             '保存
  868.                 .Buttons("fq").Enabled = False             '放弃
  869.                 .Buttons("shsh").Enabled = False           '审核
  870.                 .Buttons("shqs").Enabled = False           '弃审
  871.                 .Buttons("fgh2").Enabled = False           '分隔行
  872.                 .Buttons("first").Enabled = False          '首张
  873.                 .Buttons("prev").Enabled = False           '上张
  874.                 .Buttons("next").Enabled = False           '下张
  875.                 .Buttons("last").Enabled = False           '末张
  876.                 .Buttons("fgh5").Enabled = False           '分割行
  877.             End With
  878.       
  879.             Call Sub_ShowBill
  880.       
  881.             '设置操作状态为浏览
  882.             Lab_OperStatus.Caption = "1"
  883.       
  884.             '录入文本框
  885.             For jsqte = Max_Text_Index To 0 Step -1
  886.             LrText(jsqte).Enabled = False
  887.         Next jsqte
  888.     End Select
  889.   
  890.     '<<]
  891.   
  892. End Sub
  893. Private Sub Sub_ShowBill()                                          '根据当前单据ID显示整张单据内容
  894.    
  895.     '过程默认参数为当前窗体中单据ID:Lab_BillID
  896.     Dim Sqlstr As String                           '临时使用字符串
  897.     Dim RecTemp As New ADODB.Recordset             '临时使用动态集
  898.     Dim jsqte As Long                              '临时计数器
  899.     '禁止网格刷新动作,为加快网格显示速度(Fixed)
  900.     WglrGrid.Redraw = False
  901.     '本张单据查询字符串
  902.     Sqlstr = "SELECT KF_V_DBD.* from KF_V_DBD  Where MoveMainID=" & Val(Lab_BillId.Caption) & " Order By KF_V_DBD.MoveSubID"
  903.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  904.       
  905.     With RecTemp
  906.         WglrGrid.Rows = WglrGrid.FixedRows
  907.         If .EOF Then
  908.             WglrGrid.Redraw = True
  909.             Exit Sub
  910.         Else
  911.             '[>>显示单据头
  912.             TextChangeLock = True     '文本框加锁
  913.             
  914.             PriceMode = Trim(.Fields("PriceMode2"))  '计价方式
  915.             
  916.             If .Fields("ishqgl1") Then
  917.                 WglrGrid.ColHidden(Sydz("005", GridStr(), Szzls)) = False
  918.             Else
  919.                 WglrGrid.ColHidden(Sydz("005", GridStr(), Szzls)) = True
  920.             End If
  921.             
  922.             If .Fields("ishqgl2") Then
  923.                 WglrGrid.ColHidden(Sydz("006", GridStr(), Szzls)) = False
  924.             Else
  925.                 WglrGrid.ColHidden(Sydz("006", GridStr(), Szzls)) = True
  926.             End If
  927.             PriceMode = Trim(.Fields("PriceMode2"))
  928.             If Trim(.Fields("PriceMode2")) = "计划价法" Then
  929.                 WglrGrid.ColHidden(Sydz("009", GridStr(), Szzls)) = False
  930.                 WglrGrid.ColHidden(Sydz("011", GridStr(), Szzls)) = False
  931.             Else
  932.                 WglrGrid.ColHidden(Sydz("009", GridStr(), Szzls)) = True
  933.                 WglrGrid.ColHidden(Sydz("011", GridStr(), Szzls)) = True
  934.             End If
  935.             
  936.             LrText(0).Text = Trim(.Fields("BillNum"))                                                       '单据号
  937.         
  938.             
  939.             If IsDate(.Fields("BillDate")) Then
  940.                 LrText(1).Text = Format(.Fields("BillDate"), "yyyy-mm-dd")                                  '单据日期
  941.             End If
  942.             InID = Val(.Fields("InMainId"))                                                                 '对应入库单ID
  943.             OutID = Val(.Fields("OutMainId"))                                                               '对应出库单ID
  944.             LrText(2).Tag = Trim(.Fields("DeptCode1") & "")                                                 '转出部门
  945.             LrText(2).Text = Trim(.Fields("DeptName1") & "")                                                '转出部门
  946.             LrText(3).Tag = Trim(.Fields("DeptCode2") & "")
  947.             LrText(3).Text = Trim(.Fields("DeptName2") & "")                                                '转入部门
  948.             LrText(4).Tag = Trim(.Fields("WhCode1") & "")
  949.             LrText(4).Text = Trim(.Fields("WhName1") & "")                                                  '转出仓库
  950.             LrText(5).Tag = Trim(.Fields("WhCode2") & "")
  951.             LrText(5).Text = Trim(.Fields("WhName2") & "")                                                  '转入仓库
  952.             LrText(6).Tag = Trim(.Fields("InClass") & "")
  953.             LrText(6).Text = Trim(.Fields("InClassName") & "")                                              '入库类别
  954.             LrText(7).Tag = Trim(.Fields("OutClass") & "")
  955.             LrText(7).Text = Trim(.Fields("OutClassName") & "")                                             '出库类别
  956.             LrText(8).Tag = Trim(.Fields("PersonCode") & "")
  957.             LrText(8).Text = Trim(.Fields("PersonName") & "")                                               '人员
  958.             LrText(9).Text = Trim(.Fields("remark") & "")                                                   '备注
  959.             LrText(12).Text = Trim(.Fields("maker") & "")                                                   '制单人
  960.             LrText(11).Text = Trim(.Fields("Checker") & "")                                                 '审核人
  961.              LrText(10).Text = Trim(.Fields("ChalkitupMan") & "")
  962.             TextChangeLock = False                                                                          '文本框解锁
  963.             '<<]
  964.         End If
  965.         jsqte = WglrGrid.FixedRows
  966.         Do While Not .EOF
  967.             WglrGrid.AddItem ""
  968.             '[>>显示单据分录
  969.             WglrGrid.TextMatrix(jsqte, 0) = "*"
  970.             WglrGrid.TextMatrix(jsqte, 2) = .Fields("ispcgl")
  971.             WglrGrid.TextMatrix(jsqte, 3) = .Fields("isbzqgl")
  972.             WglrGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("MNumber") & "")       '物料编码
  973.             WglrGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("MName") & "")         '物料名称
  974.             WglrGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("Model") & "")         '规格型号
  975.             WglrGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("PrimaryUnitName") & "")   '计量单位
  976.  
  977.             If Not IsNull(.Fields("MAreaName1")) Then
  978.                 WglrGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = .Fields("MAreaName1")           '转出货区
  979.                 WglrGrid.TextMatrix(jsqte, 1) = .Fields("MArea1")
  980.             End If
  981.             If Not IsNull(.Fields("MAreaName2")) Then
  982.                 WglrGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = .Fields("MAreaName2")           '转入货区
  983.                 WglrGrid.TextMatrix(jsqte, 4) = Trim(.Fields("MArea2"))
  984.             End If
  985.                 WglrGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = Trim(.Fields("batchnum") & "")  '批次
  986.             If .Fields("Quan") <> 0 Then
  987.                 WglrGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = .Fields("Quan")                 '数量
  988.             End If
  989.             If .Fields("price") <> 0 Then
  990.                 WglrGrid.TextMatrix(jsqte, Sydz("010", GridStr(), Szzls)) = .Fields("price")                '价格
  991.             End If
  992.             If .Fields("PlanPrice") <> 0 Then
  993.                 WglrGrid.TextMatrix(jsqte, Sydz("009", GridStr(), Szzls)) = .Fields("PlanPrice")            '计划价格
  994.             End If
  995.             If .Fields("PlanMoney") <> 0 Then
  996.                 WglrGrid.TextMatrix(jsqte, Sydz("011", GridStr(), Szzls)) = .Fields("PlanMoney")            '计划金额
  997.             End If
  998.             If .Fields("EMoney") <> 0 Then
  999.                 WglrGrid.TextMatrix(jsqte, Sydz("012", GridStr(), Szzls)) = .Fields("EMoney")               '实际金额
  1000.             End If
  1001.             If Not IsNull(.Fields("InvalidDate")) Then
  1002.                 WglrGrid.TextMatrix(jsqte, Sydz("013", GridStr(), Szzls)) = .Fields("InvalidDate")          '失效日期
  1003.             End If
  1004.                    
  1005.             WglrGrid.RowHeight(jsqte) = Sjhgd
  1006.             .MoveNext
  1007.             jsqte = jsqte + 1
  1008.         Loop
  1009.     End With
  1010.        
  1011.             
  1012.     '调整网格(Fixed)
  1013.     Call Sub_AdjustGrid
  1014.     Call Cshhjwg
  1015.     '计算合计数据(Fixed)
  1016.     For jsqte = Qslz To WglrGrid.Cols - 1
  1017.         Call Sjhj(jsqte)
  1018.     Next jsqte
  1019.     
  1020.     '将网格刷新解禁(Fixed)
  1021.     WglrGrid.Redraw = True
  1022.        
  1023.     '设置审核弃审按钮状态
  1024.     Call Sub_CheckStatus
  1025.        
  1026. End Sub
  1027. Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button)             '用户点击工具条
  1028.      
  1029.     '屏蔽文本框,下拉组合框有效性判断
  1030.     Valilock = True
  1031.      
  1032.     '屏蔽网格失去焦点产生的有效性判断
  1033.     Changelock = True
  1034.          
  1035.     Select Case Button.Key
  1036.         Case "yl"                                            '预 览
  1037.             If Fun_Drfrmyxxpd Then
  1038.                 If PriceMode = "计划价法" Then
  1039.                     BillGridPrint WglrGrid, LrText, GridStr(), Szzls, GridCode, TextGroupCode, XtReportCode, False, "plan"
  1040.                 Else
  1041.                     BillGridPrint WglrGrid, LrText, GridStr(), Szzls, GridCode, TextGroupCode, XtReportCode, False, "default"
  1042.                 End If
  1043.             End If
  1044.         Case "dy"                                            '打 印
  1045.             If Fun_Drfrmyxxpd Then
  1046.                 Dim Yhanswer As Integer      '打印提示
  1047.                 
  1048.                 '用户确认是否打印单据
  1049.                 Tsxx = "请确认是否打印当前单据?"
  1050.                 Yhanswer = Xtxxts(Tsxx, 2, 2)
  1051.                 If Yhanswer = 2 Then
  1052.                     Exit Sub
  1053.                 End If
  1054.                 If PriceMode = "计划价法" Then
  1055.                     BillGridPrint WglrGrid, LrText, GridStr(), Szzls, GridCode, TextGroupCode, XtReportCode, True, "plan"
  1056.                 Else
  1057.                     BillGridPrint WglrGrid, LrText, GridStr(), Szzls, GridCode, TextGroupCode, XtReportCode, True, "default"
  1058.                 End If
  1059.             End If
  1060.         Case "xz"                                            '新 增
  1061.             Call Sub_AddBill
  1062.         Case "xg"                                            '修 改
  1063.             Call Sub_EditBill
  1064.         Case "sc"                                            '删 除
  1065.             Call Sub_DeleteBill
  1066.         Case "zh"                                            '增 行
  1067.             Call zjlrfl
  1068.         Case "sh"                                            '删 行
  1069.             Call Scdqfl
  1070.         Case "bc"                                            '保 存
  1071.             If Fun_Drfrmyxxpd Then
  1072.                 Call Sub_SaveBill
  1073.             End If
  1074.         Case "fq"                                            '放 弃
  1075.             Call Sub_AbandonBill
  1076.         Case "shsh"                                          '审 核
  1077.             Call Sub_CheckBill
  1078.         Case "shqs"                                          '弃 审
  1079.             Call Sub_AbandonCheck
  1080.         Case "first"                                         '首 张
  1081.             Call Sub_First
  1082.         Case "prev"                                          '上 张
  1083.             Call Sub_Prev
  1084.         Case "next"                                          '下 张
  1085.             Call Sub_next
  1086.         Case "last"                                          '末 张
  1087.             Call Sub_Last
  1088.         Case "bz"                                            '帮 助
  1089.             Call F1bz
  1090.         Case "fh"                                            '退 出
  1091.             Unload Me
  1092.     End Select
  1093.        
  1094.     '解 锁
  1095.     Valilock = False
  1096.     Changelock = False
  1097.     TextChangeLock = False
  1098.         
  1099. End Sub
  1100. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)     '支持热键操作
  1101.     
  1102.     Select Case KeyCode
  1103.         Case vbKeyF5          '增加单据
  1104.             If Tlb_Action.Buttons("xz").Enabled And Tlb_Action.Buttons("xz").Visible Then
  1105.                 Call Sub_AddBill
  1106.             End If
  1107.         Case vbKeyF3          '修改单据
  1108.             If Tlb_Action.Buttons("xg").Enabled And Tlb_Action.Buttons("xg").Visible Then
  1109.                 Call Sub_EditBill
  1110.             End If
  1111.         Case vbKeyF6          '保存单据
  1112.             If Tlb_Action.Buttons("bc").Enabled And Tlb_Action.Buttons("bc").Visible Then
  1113.                 If Fun_Drfrmyxxpd Then Call Sub_SaveBill
  1114.             End If
  1115.     End Select
  1116. End Sub
  1117. Private Sub Sub_OperStatus(Str_Status As String)                 '工具条依据不同状态所进行的变化
  1118.     
  1119.     With Tlb_Action
  1120.         Select Case Str_Status
  1121.             Case "10"   '浏览((列表)调入单据处理时的进入状态、(列表)新增状态时放弃录入)
  1122.                 '工具条
  1123.                 .Buttons("dy").Enabled = True       '打印
  1124.                 .Buttons("yl").Enabled = True       '预览
  1125.                 .Buttons("xz").Enabled = True       '新增
  1126.                 .Buttons("xg").Enabled = True       '修改
  1127.                 .Buttons("sc").Enabled = True       '删除
  1128.                 .Buttons("zh").Enabled = False      '增行
  1129.                 .Buttons("sh").Enabled = False      '删行
  1130.                 .Buttons("bc").Enabled = False      '保存
  1131.                 .Buttons("fq").Enabled = False      '放弃
  1132.                 .Buttons("first").Enabled = True    '首张
  1133.                 .Buttons("prev").Enabled = True     '上张
  1134.                 .Buttons("next").Enabled = True     '下张
  1135.                 .Buttons("last").Enabled = True     '末张
  1136.                 .Buttons("bz").Enabled = True       '帮助
  1137.                 .Buttons("fh").Enabled = True       '退出
  1138.         
  1139.                 '设置审核弃审按钮状态
  1140.                 Call Sub_CheckStatus
  1141.         
  1142.                 '设置文本框录入状态
  1143.                 Call Sub_LrtextStatus(False)
  1144.             Case "20"   '新增单据((录入)新增一张单据 、(列表)新增一张单据)
  1145.                 '工具条
  1146.                 .Buttons("dy").Enabled = False      '打印
  1147.                 .Buttons("yl").Enabled = False      '预览
  1148.                 .Buttons("xz").Enabled = False      '新增
  1149.                 .Buttons("xg").Enabled = False      '修改
  1150.                 .Buttons("sc").Enabled = False      '删除
  1151.                 .Buttons("zh").Enabled = True       '增行
  1152.                 .Buttons("sh").Enabled = True       '删行
  1153.                 .Buttons("bc").Enabled = True       '保存
  1154.                 .Buttons("fq").Enabled = True       '放弃
  1155.                 .Buttons("shsh").Enabled = False    '审核
  1156.                 .Buttons("shqs").Enabled = False    '弃审
  1157.                 .Buttons("first").Enabled = False   '首张
  1158.                 .Buttons("prev").Enabled = False    '上张
  1159.                 .Buttons("next").Enabled = False    '下张
  1160.                 .Buttons("last").Enabled = False    '末张
  1161.                 .Buttons("bz").Enabled = True       '帮助
  1162.                 .Buttons("fh").Enabled = True       '退出
  1163.                 
  1164.                 '设置文本框录入状态
  1165.                 Call Sub_LrtextStatus(True)
  1166.             Case "30"   '修改((录入)调入修改功能、(列表)调入修改功能)
  1167.                 '工具条
  1168.                 .Buttons("dy").Enabled = False      '打印
  1169.                 .Buttons("yl").Enabled = False      '预览
  1170.                 .Buttons("xz").Enabled = False      '新增
  1171.                 .Buttons("xg").Enabled = False      '修改
  1172.                 .Buttons("sc").Enabled = False      '删除
  1173.                 .Buttons("zh").Enabled = True       '增行
  1174.                 .Buttons("sh").Enabled = True       '删行
  1175.                 .Buttons("bc").Enabled = True       '保存
  1176.                 .Buttons("fq").Enabled = True       '放弃
  1177.                 .Buttons("shsh").Enabled = False    '审核
  1178.                 .Buttons("shqs").Enabled = False    '弃审
  1179.                 .Buttons("first").Enabled = False   '首张
  1180.                 .Buttons("prev").Enabled = False    '上张
  1181.                 .Buttons("next").Enabled = False    '下张
  1182.                 .Buttons("last").Enabled = False    '末张
  1183.                 .Buttons("bz").Enabled = True       '帮助
  1184.                 .Buttons("fh").Enabled = True       '退出
  1185.                 
  1186.                 '设置文本框录入状态
  1187.                 Call Sub_LrtextStatus(True)
  1188.         End Select
  1189.     End With
  1190. End Sub
  1191. Private Sub Sub_LrtextStatus(TextEnabled As Boolean)                            '设置录入文本框状态
  1192.     '录入文本框状态设置
  1193.     If TextEnabled Then
  1194.         For jsqte = Max_Text_Index To 0 Step -1
  1195.             '判断文本框是否可编辑
  1196.             If Textboolean(jsqte, 5) Then
  1197.                 LrText(jsqte).Enabled = True
  1198.             Else
  1199.                 LrText(jsqte).Enabled = False
  1200.             End If
  1201.         Next jsqte
  1202.     Else
  1203.         For jsqte = Max_Text_Index To 0 Step -1
  1204.             LrText(jsqte).Enabled = False
  1205.         Next jsqte
  1206.     End If
  1207. End Sub
  1208. Private Sub Sub_CheckStatus()                                       '设置审核弃审按钮状态(亦可设置其他动作按钮状态)
  1209.     
  1210.     '根据当前单据状态来确定审核弃审按钮状态
  1211.     If Trim(LrText(12).Text) <> "" And Trim(LrText(11).Text) = "" Then
  1212.         Tlb_Action.Buttons("shsh").Enabled = True      '审核
  1213.     Else
  1214.         Tlb_Action.Buttons("shsh").Enabled = False   '审核
  1215.     End If
  1216.     If Trim(LrText(12).Text) <> "" And Trim(LrText(11).Text) <> "" Then
  1217.         Tlb_Action.Buttons("shqs").Enabled = True      '弃审
  1218.     Else
  1219.         Tlb_Action.Buttons("shqs").Enabled = False   '弃审
  1220.     End If
  1221. End Sub
  1222. Private Sub Wbkcl()                                                 '文本框录入之前处理(根据实际情况)
  1223.     
  1224.     Dim xswbrr As String
  1225.     With WglrGrid
  1226.         Zdlrqnr = Trim(.Text)
  1227.         xswbrr = Trim(.Text)
  1228.         If GridBoolean(.Col, 3) Then   '列表框录入
  1229.             '填充列表框程序
  1230.             Call FillCombo(YdCombo, GridStr(.Col, 5), xswbrr, 0)
  1231.         Else
  1232.             Wbkbhlock = True
  1233.        
  1234.             '====以下为用户自定义
  1235.             Ydtext.Text = xswbrr
  1236.             '====以上为用户自定义
  1237.          
  1238.             Wbkbhlock = False
  1239.             Ydtext.SelStart = Len(Ydtext.Text)
  1240.         End If
  1241.     End With
  1242. End Sub
  1243. Private Function sjzdyxxpd(Dqpdwgh As Long, Dqpdwgl As Long) As Boolean       '录入数据字段有效性判断,同时进行字段录入事后处理
  1244.  
  1245.     '函数参数:Dqpdwgh, Dqpdwgl 当前要判断网格单元所处行列值
  1246.     Dim Str_JudgeText As String                 '临时有效性判断字段内容
  1247.     Dim Coljsq As Long                          '临时列计数器
  1248.     Dim RecTemp As New ADODB.Recordset          '临时使用动态集
  1249.     Dim Sqlstr As String                        '临时使用查询字符串
  1250.     With WglrGrid
  1251.         '非录入状态或非数据行则其有效性为合法
  1252.         If Yxxpdlock Or .Row < .FixedRows Then
  1253.             sjzdyxxpd = True
  1254.             Exit Function
  1255.         End If
  1256.         
  1257.         '取得当前要判断字段内容
  1258.         Str_JudgeText = Trim(.TextMatrix(Dqpdwgh, Dqpdwgl))
  1259.       
  1260.         '根据不同字段进行相应的处理(依据其逻辑编号)
  1261.         Select Case GridStr(Dqpdwgl, 1)
  1262.             '[>>以下为自定义部分
  1263.             Case "001"                   '物料编码
  1264.                If Not Trim(Str_JudgeText) = "" Then
  1265.                     '1.放置字段有效性判断
  1266.                 Sqlstr = "SELECT MNumber,MName,Model,PrimaryUnit,PrimaryUnitName,Ispcgl,Isbzqgl,planprice From Gy_Material Where stopflag=0 and MNumber='" & Trim(Str_JudgeText) & "' Or MName='" & Trim(Str_JudgeText) & "'"
  1267.                     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  1268.                     If RecTemp.EOF Then
  1269.                         Tsxx = "此物料编码不存在!"
  1270.                         GoTo Lrcwcl
  1271.                     Else
  1272.                         '2.放置字段事后处理程序
  1273.                       '显示相关信息
  1274.                         
  1275.                         .TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls)) = Trim(RecTemp.Fields("MNumber") & "")
  1276.                         .TextMatrix(Dqpdwgh, Sydz("002", GridStr(), Szzls)) = Trim(RecTemp.Fields("MName") & "")
  1277.                         .TextMatrix(Dqpdwgh, Sydz("003", GridStr(), Szzls)) = Trim(RecTemp.Fields("Model") & "")
  1278.                         .TextMatrix(Dqpdwgh, Sydz("004", GridStr(), Szzls)) = Trim(RecTemp.Fields("PrimaryUnitName") & "")
  1279.                         .TextMatrix(Dqpdwgh, 2) = RecTemp.Fields("Ispcgl")
  1280.                         .TextMatrix(Dqpdwgh, 3) = RecTemp.Fields("Isbzqgl")
  1281.                         
  1282.                         If PriceMode = "计划价法" And Val(RecTemp.Fields("PlanPrice")) <> 0 Then
  1283.                             .TextMatrix(Dqpdwgh, Sydz("009", GridStr(), Szzls)) = Val(RecTemp.Fields("PlanPrice"))
  1284.                         End If
  1285.                     End If
  1286.                     '根据公式计算结果
  1287.                         Call Sub_JoinCount(Dqpdwgh, Sydz("008", GridStr(), Szzls))
  1288.                         Call Sub_JoinCount(Dqpdwgh, Sydz("010", GridStr(), Szzls))
  1289.                         Call Sub_JoinCount(Dqpdwgh, Sydz("012", GridStr(), Szzls))
  1290.                 Else
  1291.                     '3.清空相关字段
  1292.                     .TextMatrix(Dqpdwgh, Sydz("002", GridStr(), Szzls)) = ""                                             '物料名称
  1293.                     .TextMatrix(Dqpdwgh, Sydz("003", GridStr(), Szzls)) = ""                                             '物料规格型号
  1294.                     .TextMatrix(Dqpdwgh, Sydz("004", GridStr(), Szzls)) = ""
  1295.                 End If
  1296.     
  1297.             Case "005"
  1298.                 '1.放置字段有效性判断
  1299.                 '2.放置字段事后处理程序
  1300.                 If Not Trim(Str_JudgeText) = "" Then
  1301.                   Sqlstr = "SELECT MArea,MAreaName From KF_Marea Where (MArea='" & Trim(Str_JudgeText) & "' Or MAreaName='" & Trim(Str_JudgeText) & "') and whcode='" & Trim(LrText(4).Tag) & "' and endflag=1"
  1302.                     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  1303.                         If RecTemp.EOF Then
  1304.                             Tsxx = "此货区不存在或不属于本仓库或不是末级货区!"
  1305.                             GoTo Lrcwcl
  1306.                         End If
  1307.                         .TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls)) = Trim(RecTemp.Fields("MAreaName") & "")
  1308.                         .TextMatrix(Dqpdwgh, 1) = Trim(RecTemp.Fields("MArea") & "")
  1309.                 End If
  1310.             Case "006"
  1311.                 '1.放置字段有效性判断
  1312.                 '2.放置字段事后处理程序
  1313.                 If Not Trim(Str_JudgeText) = "" Then
  1314.                   Sqlstr = "SELECT MArea,MAreaName From KF_Marea Where (MArea='" & Trim(Str_JudgeText) & "' Or MAreaName='" & Trim(Str_JudgeText) & "') and whcode='" & Trim(LrText(5).Tag) & "' and endflag=1"
  1315.                     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  1316.                         If RecTemp.EOF Then
  1317.                             Tsxx = "此货区不存在或不属于本仓库或不是末级货区!"
  1318.                             GoTo Lrcwcl
  1319.                         End If
  1320.                         .TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls)) = Trim(RecTemp.Fields("MAreaName") & "")
  1321.                         .TextMatrix(Dqpdwgh, 4) = Trim(RecTemp.Fields("MArea") & "")
  1322.                 End If
  1323.                 
  1324.             Case "007"
  1325.                 If .TextMatrix(Dqpdwgh, 0) = "*" Then
  1326.                     If Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))) = "" Then
  1327.                         Tsxx = "请先输入物料!"
  1328.                         Dqpdwgl = Sydz("001", GridStr(), Szzls)
  1329.                         GoTo Lrcwcl
  1330.                     End If
  1331.                     '先输入批次和货区
  1332.                     If conArea = 1 Then
  1333.                         If Not .ColHidden(Sydz("005", GridStr(), Szzls)) Then
  1334.                             If Trim(.TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls))) = "" Then
  1335.                                 Tsxx = "请先输入转出货区!"
  1336.                                 Dqpdwgl = Sydz("005", GridStr(), Szzls)
  1337.                                 GoTo Lrcwcl
  1338.                             End If
  1339.                         End If
  1340.                     End If
  1341.                     
  1342.                     If conArea = 1 Then
  1343.                         If Not .ColHidden(Sydz("006", GridStr(), Szzls)) Then
  1344.                             If Trim(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls))) = "" Then
  1345.                                 Tsxx = "请先输入转入货区!"
  1346.                                 Dqpdwgl = Sydz("006", GridStr(), Szzls)
  1347.                                 GoTo Lrcwcl
  1348.                             End If
  1349.                         End If
  1350.                     End If
  1351.                     
  1352.                     '如果对应物料不使用批此管理,则设为空值
  1353.                     If conBatch = 1 Then
  1354.                         If Trim(.TextMatrix(Dqpdwgh, 2)) <> "" Then
  1355.                             If CBool(.TextMatrix(Dqpdwgh, 2)) = False Then
  1356.                                 .TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)) = ""
  1357.                             Else
  1358.                                 '如果为批次管理的物料则显示判断此批号是否存在
  1359.                                 If Trim(Str_JudgeText) <> "" Then
  1360.                                 If BatchJudge(Trim(LrText(4).Tag), .TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls)), .TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)), intCount, intFatherID(), intChildID(), IsQc(), False) = 1 Then
  1361.                                     Tsxx = "此批号不存在!"
  1362.                                     Dqpdwgl = Sydz("007", GridStr(), Szzls)
  1363.                                     GoTo Lrcwcl
  1364.                                 End If
  1365.                                 End If
  1366.                             End If
  1367.                         End If
  1368.                     End If
  1369.                 End If
  1370.             Case "008"          '数量
  1371.                 '1.放置字段有效性判断
  1372.                  If Trim(.TextMatrix(Dqpdwgh, 0)) = "*" Then
  1373.                      If Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))) = "" Then
  1374.                         Tsxx = "请先输入物料!"
  1375.                         Dqpdwgl = Sydz("001", GridStr(), Szzls)
  1376.                         GoTo Lrcwcl
  1377.                      End If
  1378.                      
  1379.                     '先输入批次和货区
  1380.                     If conArea = 1 Then
  1381.                         If Not .ColHidden(Sydz("005", GridStr(), Szzls)) Then
  1382.                             If Trim(.TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls))) = "" Then
  1383.                                 Tsxx = "请先输入转出货区!"
  1384.                                 Dqpdwgl = Sydz("005", GridStr(), Szzls)
  1385.                                 GoTo Lrcwcl
  1386.                             End If
  1387.                         End If
  1388.                         If Not .ColHidden(Sydz("006", GridStr(), Szzls)) Then
  1389.                             If Trim(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls))) = "" Then
  1390.                                 Tsxx = "请先输入转入货区!"
  1391.                                 Dqpdwgl = Sydz("006", GridStr(), Szzls)
  1392.                                 GoTo Lrcwcl
  1393.                             End If
  1394.                         End If
  1395.                      End If
  1396.                      If conBatch = 1 Then
  1397.                         If CBool(.TextMatrix(Dqpdwgh, 2)) = True Then
  1398.                             If Trim(.TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls))) = "" Then
  1399.                                 Tsxx = "请先输入批号!"
  1400.                                 Dqpdwgl = Sydz("007", GridStr(), Szzls)
  1401.                                 GoTo Lrcwcl
  1402.                             End If
  1403.                         End If
  1404.                      End If
  1405.                     If Val(Str_JudgeText) = 0 Then
  1406.                         Tsxx = "数量不能为0!"
  1407.                         Dqpdwgl = Sydz("008", GridStr(), Szzls)
  1408.                         GoTo Lrcwcl
  1409.                     End If
  1410.                     If Val(.TextMatrix(Dqpdwgh, Sydz("012", GridStr(), Szzls))) < 0 Then
  1411.                         If Val(Str_JudgeText) > 0 Then
  1412.                             Tsxx = "金额为负值,数量不允许为正值!"
  1413.                             Dqpdwgl = Sydz("008", GridStr(), Szzls)
  1414.                             GoTo Lrcwcl
  1415.                         End If
  1416.                     ElseIf Val(.TextMatrix(Dqpdwgh, Sydz("012", GridStr(), Szzls))) > 0 Then
  1417.                         If Val(Str_JudgeText) < 0 Then
  1418.                             Tsxx = "金额为正值,数量不允许为负值!"
  1419.                             Dqpdwgl = Sydz("008", GridStr(), Szzls)
  1420.                             GoTo Lrcwcl
  1421.                         End If
  1422.                     End If
  1423.                     '与现存量比较
  1424.                     Dim tempResult As Double
  1425.                     
  1426.                     If KFNowQuan(Trim(LrText(4).Tag), Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))), Trim(.TextMatrix(Dqpdwgh, 1) & ""), Trim(.TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls))), Val(.TextMatrix(Dqpdwgh, Sydz("008", GridStr(), Szzls))), Val(OutID), tempResult) = 0 Then
  1427.                         '如果批次管理,则不允许负出库
  1428.                         If conBatch = 1 Then
  1429.                             If CBool(.TextMatrix(Dqpdwgh, 2)) = True Then
  1430.                                 Tsxx = "您要出库的数量大于现存量,现存量为:" & tempResult
  1431.                                 Dqpdwgl = Sydz("008", GridStr(), Szzls)
  1432.                                 GoTo Lrcwcl
  1433.                             End If
  1434.                         End If
  1435.                         If conAllow <> 1 Then
  1436.                             Tsxx = "您要出库的数量大于现存量,现存量为:" & tempResult
  1437.                             Dqpdwgl = Sydz("008", GridStr(), Szzls)
  1438.                             GoTo Lrcwcl
  1439.                         End If
  1440.                         
  1441.                     End If
  1442.                     '高储和低储判断
  1443.                     If conAlart = 1 Then
  1444.                         Call KFHLJudge(CInt(conHLJudge), Trim(LrText(1).Tag), Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))), Trim(.TextMatrix(Dqpdwgh, 1) & ""), Val(.TextMatrix(Dqpdwgh, Sydz("008", GridStr(), Szzls))), 0, Val(Lab_BillId.Caption))
  1445.                     End If
  1446.                     
  1447.                     
  1448.                     '2.放置字段事后处理程序
  1449.                     Call Sub_JoinCount(Dqpdwgh, Sydz("008", GridStr(), Szzls))
  1450.                 End If
  1451.             Case "010"          '单价
  1452.                 '1.放置字段有效性判断
  1453.                 
  1454.                 '2.放置字段事后处理程序
  1455.                 Call Sub_JoinCount(Dqpdwgh, Sydz("010", GridStr(), Szzls))
  1456.             Case "012"         '金额
  1457.                 '1.放置字段有效性判断
  1458.                 '如果数量为负值,则要求金额为负值
  1459.                 If Val(.TextMatrix(Dqpdwgh, Sydz("008", GridStr(), Szzls))) < 0 Then
  1460.                     If Val(Str_JudgeText) > 0 Then
  1461.                         Tsxx = "数量为负值,金额不允许为正值!"
  1462.                         Dqpdwgl = Sydz("012", GridStr(), Szzls)
  1463.                         GoTo Lrcwcl
  1464.                     End If
  1465.                 ElseIf Val(.TextMatrix(Dqpdwgh, Sydz("008", GridStr(), Szzls))) > 0 Then
  1466.                     If Val(Str_JudgeText) < 0 Then
  1467.                         Tsxx = "数量为正值,金额不允许为负值!"
  1468.                         Dqpdwgl = Sydz("012", GridStr(), Szzls)
  1469.                         GoTo Lrcwcl
  1470.                     End If
  1471.                 End If
  1472.                 '2.放置字段事后处理程序
  1473.                 Call Sub_JoinCount(Dqpdwgh, Sydz("012", GridStr(), Szzls))
  1474.                 
  1475.             Case "013"          '失效日期
  1476.                 If Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))) <> "" Then
  1477.                         If Val(conQuan) = 1 Then
  1478.                              If Not CBool(.TextMatrix(Dqpdwgh, 3)) Then
  1479.                                .TextMatrix(Dqpdwgh, Sydz("013", GridStr(), Szzls)) = ""
  1480.                              End If
  1481.                         End If
  1482.                  If Val(conQuan) = 1 Then
  1483.                     If Trim(.TextMatrix(Dqpdwgh, Sydz("013", GridStr(), Szzls))) <> "" Then
  1484.                         If Not IsDate(Str_JudgeText) Then
  1485.                             Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
  1486.                             GoTo Lrcwcl
  1487.                         Else
  1488.                             If CDate(Str_JudgeText) < Xtrq Then
  1489.                                 Tsxx = "失效日期不能小于系统登录日期!"
  1490.                                 GoTo Lrcwcl
  1491.                             End If
  1492.                         End If
  1493.                     
  1494.                     End If
  1495.                  End If
  1496.                 Else
  1497.                     Tsxx = "请先输入物料编码!"
  1498.                     Call Xtxxts(Tsxx, 0, 1)
  1499.                     .TextMatrix(Dqpdwgh, Sydz("013", GridStr(), Szzls)) = ""
  1500.                    
  1501.                 End If
  1502.                 '<<以上为自定义部分]
  1503.         End Select
  1504.         
  1505.         '字段录入正确后为零字段清空(Fixed)
  1506.         Call Qkwlzd(Dqpdwgh, Dqpdwgl)
  1507.      
  1508.         '字段录入正确后进行数据合计(Fixed)
  1509.         For Coljsq = Qslz To .Cols - 1
  1510.             Call Sjhj(Coljsq)
  1511.         Next Coljsq
  1512.      
  1513.         '字段有效性判断通过,将字段有效性判断加锁直至再次改变(Fixed)
  1514.         sjzdyxxpd = True
  1515.         Yxxpdlock = True
  1516.         Exit Function
  1517.     End With
  1518.   
  1519. Lrcwcl:    '录入错误处理
  1520.     With WglrGrid
  1521.   
  1522.         '给出错误提示信息
  1523.         Call Xtxxts(Tsxx, 0, 1)
  1524.           
  1525.         '返回网格错误位置(ChangeLock避免再次引发RowColChange有效性判断),装入录入载体
  1526.         Changelock = True
  1527.         .Select Dqpdwgh, Dqpdwgl
  1528.         Changelock = False
  1529.         Call xswbk
  1530.           
  1531.         '函数返回False
  1532.         sjzdyxxpd = False
  1533.         Exit Function
  1534.     End With
  1535. End Function
  1536. Private Sub Sub_JoinCount(Lng_CountRow As Long, Lng_CountCol As Long)       '当网格列值发生改变时,处理网格列之间的关联计算(可选)
  1537.   
  1538.   '过程参数:Lng_CountRow,Lng_CountCol 网格改变内容所处行列值
  1539.    
  1540.     With WglrGrid
  1541.         Select Case GridStr(Lng_CountCol, 1)         '判断网格列对应逻辑编号
  1542.                
  1543.             '[>>以下为自定义部分
  1544.             Case "008"  '数量
  1545.                 '数量*单价=金额
  1546.                 If Val(.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls))) <> 0 Then
  1547.                     If Val(.TextMatrix(Lng_CountRow, Sydz("012", GridStr(), Szzls))) / Val(.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls))) <> 0 Then
  1548.                         .TextMatrix(Lng_CountRow, Sydz("010", GridStr(), Szzls)) = Format(Val(.TextMatrix(Lng_CountRow, Sydz("012", GridStr(), Szzls))) / Val(.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls))), "###0." + String(Xtdjxsws, "0"))
  1549.                     Else
  1550.                         .TextMatrix(Lng_CountRow, Sydz("010", GridStr(), Szzls)) = ""
  1551.                     End If
  1552.                 End If
  1553.                 '数量*计划单价=计划金额
  1554.                 If Val(.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls))) * Val(.TextMatrix(Lng_CountRow, Sydz("009", GridStr(), Szzls))) <> 0 Then
  1555.                     .TextMatrix(Lng_CountRow, Sydz("011", GridStr(), Szzls)) = Format(Val(.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls))) * Val(.TextMatrix(Lng_CountRow, Sydz("009", GridStr(), Szzls))), "###0." + String(Xtslxsws, "0"))
  1556.                 Else
  1557.                     .TextMatrix(Lng_CountRow, Sydz("011", GridStr(), Szzls)) = ""
  1558.                 End If
  1559.                 
  1560.             Case "010"      '单价
  1561.                 If Val(.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls))) <> 0 Then
  1562.                     If Val(.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls))) * Val(.TextMatrix(Lng_CountRow, Sydz("010", GridStr(), Szzls))) <> 0 Then
  1563.                         .TextMatrix(Lng_CountRow, Sydz("012", GridStr(), Szzls)) = Format(Val(.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls))) * Val(.TextMatrix(Lng_CountRow, Sydz("010", GridStr(), Szzls))), "###0." + String(Xtjexsws, "0"))
  1564.                     Else
  1565.                         .TextMatrix(Lng_CountRow, Sydz("012", GridStr(), Szzls)) = ""
  1566.                     End If
  1567.                 End If
  1568.             Case "012"      '金额
  1569.                 If Val(.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls))) <> 0 Then
  1570.                     If Val(.TextMatrix(Lng_CountRow, Sydz("012", GridStr(), Szzls))) / Val(.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls))) <> 0 Then
  1571.                         .TextMatrix(Lng_CountRow, Sydz("010", GridStr(), Szzls)) = Format(Val(.TextMatrix(Lng_CountRow, Sydz("012", GridStr(), Szzls))) / Val(.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls))), "###0." + String(Xtdjxsws, "0"))
  1572.                     End If
  1573.                 End If
  1574.             '<<以上为自定义部分]
  1575.         End Select
  1576.     End With
  1577. End Sub
  1578. Private Function Sjhzyxxpd(ByVal Yxxpdh As Long) As Boolean                     '录入数据行有效性判断,同时进行行处理
  1579.  
  1580.     '函数参数:Yxxpdh 要进行有效性判断的网格数据行的行值
  1581.     Dim Lrywlz As Long                            '录入有误网格列值
  1582.     Dim RecTemp As New ADODB.Recordset            '临时使用动态集
  1583.     
  1584.     With WglrGrid
  1585.         If Yxxpdh > (.Rows - 1) Then Exit Function
  1586.         '判断行为空(行中所有可编辑列数据均为空或为零)和无效数据行则清除当前行
  1587.         If .TextMatrix(Yxxpdh, 0) <> "*" Then
  1588.             Sjhzyxxpd = True
  1589.             Exit Function
  1590.         Else
  1591.             If pdhwk(Yxxpdh) And Yxxpdh + 1 <= .Rows - 1 Then
  1592.                 '当要判断行处于网格末行时才允许删行,否则要进行有效性判断
  1593.                 If .TextMatrix(Yxxpdh + 1, 0) <> "*" Then
  1594.                     Changelock = True
  1595.                     .RemoveItem Yxxpdh
  1596.                     If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  1597.                         .AddItem ""
  1598.                         .RowHeight(.Rows - 1) = Sjhgd
  1599.                     End If
  1600.                     Changelock = False
  1601.                     Sjhzyxxpd = True
  1602.                     Exit Function
  1603.                 End If
  1604.             End If
  1605.         End If
  1606.   
  1607.         '行没有发生变化则不进行有效性判断
  1608.         If Hyxxpdlock Then
  1609.             Sjhzyxxpd = True
  1610.             Exit Function
  1611.         End If
  1612.   
  1613.         '[>>以下为自定义部分
  1614.     
  1615.         '1.放置行有效性判断程序
  1616.            
  1617.         '1.1首先进行单个不能为空或不能为零判断(Fixed)
  1618.         For jsqte = Qslz To .Cols - 1
  1619.             
  1620.             '字段不能为空
  1621.          If Not .ColHidden(jsqte) Then
  1622.             If GridInt(jsqte, 5) = 1 Then
  1623.                 If Len(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0 Then
  1624.                     Tsxx = GridStr(jsqte, 2)
  1625.                     Lrywlz = jsqte
  1626.                     GoTo Lrcwcl
  1627.                     Exit For
  1628.                 End If
  1629.             End If
  1630.             
  1631.          End If
  1632.             '字段不能为零
  1633.             If GridInt(jsqte, 5) = 2 Then
  1634.                 If Val(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0 Then
  1635.                     Tsxx = GridStr(jsqte, 2)
  1636.                     Lrywlz = jsqte
  1637.                     GoTo Lrcwcl
  1638.                     Exit For
  1639.                 End If
  1640.             End If
  1641.             If Val(conBatch) = 1 Then
  1642.                 If CBool(.TextMatrix(Yxxpdh, 2)) Then
  1643.                     If Trim(.TextMatrix(Yxxpdh, Sydz("007", GridStr(), Szzls))) = "" Then
  1644.                         Tsxx = "此物料是批次管理,批号不能为空!"
  1645.                         Lrywlz = Sydz("007", GridStr(), Szzls)
  1646.                         GoTo Lrcwcl
  1647.                     End If
  1648.                 End If
  1649.             End If
  1650.         Next jsqte
  1651.         
  1652.         '1.2进行其他有效性判断,编写格式同1.1
  1653.             
  1654.         '2.放置行处理程序(当数据行通过有效性判断)
  1655.         '以上为自定义部分<<]
  1656.     End With    'WglrGrid
  1657.     '如果此行通过行有效性判断则加锁,直至此行数据再次发生变化
  1658.     Sjhzyxxpd = True
  1659.     Hyxxpdlock = True
  1660.     Exit Function
  1661. Lrcwcl:      '录入错误处理
  1662.     With WglrGrid
  1663.   
  1664.         '给出错误提示信息
  1665.         Call Xtxxts(Tsxx, 0, 1)
  1666.       
  1667.         '返回网格错误位置 (ChangeLock避免再次引发RowColChange有效性判断), 装入录入载体
  1668.         Changelock = True
  1669.         .Select Yxxpdh, Lrywlz
  1670.         Changelock = False
  1671.         Call xswbk
  1672.     
  1673.         '函数返回False
  1674.         Sjhzyxxpd = False
  1675.         Exit Function
  1676.     End With
  1677. End Function
  1678. Private Sub Sub_AddBill()                                                '新增一张单据
  1679.     
  1680.     Dim RecTemp As New ADODB.Recordset            '临时使用动态集
  1681.     Dim jsqte As Long                             '临时计数器
  1682.     '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  1683.      If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
  1684.         Exit Sub
  1685.      End If
  1686.    
  1687.     '设置操作状态为新增(Fixed)
  1688.     Lab_OperStatus.Caption = "2"
  1689.        
  1690.     '设置工具条状态(Fixed)
  1691.     Call Sub_OperStatus("20")
  1692.    
  1693.     '清空VouchID(Fixed)
  1694.     Lab_BillId.Caption = ""
  1695.       
  1696.     '录入文本框清除内容
  1697.     For jsqte = Max_Text_Index To 0 Step -1
  1698.         LrText(jsqte).Tag = ""
  1699.         LrText(jsqte).Text = ""
  1700.     Next jsqte
  1701.    
  1702.     '[>>显示制单人,清空审核人,此处还可以设置录入默认值如自动生成单据号、默认单据录入日期注意加锁
  1703.     LrText(10).Text = ""
  1704.     LrText(11).Text = ""
  1705.     LrText(12).Text = Xtczy
  1706.     '读取最新的单据编码
  1707.     LrText(0).Text = CreatBillCode(BillCode, False)
  1708.        
  1709.     '设置订单日期默认为系统业务日期
  1710.     TextChangeLock = True
  1711.     LrText(1).Text = Format(Xtrq, "yyyy-mm-dd")
  1712.     TextChangeLock = False
  1713.    
  1714.     '<<]
  1715.    
  1716.     '重置网格(Fixed)
  1717.     With WglrGrid
  1718.         .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  1719.         For jsqte = .FixedRows To .Rows - 1
  1720.             .RowHeight(jsqte) = Sjhgd
  1721.         Next jsqte
  1722.         WglrGrid.Clear 1
  1723.         Changelock = True
  1724.         .Select .FixedRows, Qslz
  1725.         Changelock = False
  1726.     End With
  1727.    
  1728.     '计算合计数据(清零)(Fixed)
  1729.     For jsqte = Qslz To WglrGrid.Cols - 1
  1730.         Call Sjhj(jsqte)
  1731.     Next jsqte
  1732.     
  1733.     '让第一个录入项得到焦点(Fixed)
  1734.     On Error Resume Next
  1735.     LrText(1).SetFocus
  1736.    Call VisulGrid
  1737. End Sub
  1738. Private Sub Sub_EditBill()                                                '修改一张单据
  1739.    
  1740.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  1741.     '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  1742.      If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
  1743.         Exit Sub
  1744.      End If
  1745.    
  1746.     '非有效单据不予进行修改动作
  1747.     If Val(Lab_BillId.Caption) = 0 Then
  1748.         Exit Sub
  1749.     End If
  1750.    
  1751.     '判断当前单据是否允许修改
  1752.     If Not Fun_AllowEdit Then
  1753.         Exit Sub
  1754.     End If
  1755.    
  1756.     '设置操作状态为修改
  1757.     Lab_OperStatus.Caption = "3"
  1758.    
  1759.     '设置工具条状态
  1760.     Call Sub_OperStatus("30")
  1761.         
  1762.     '显示制单人
  1763.     LrText(12).Text = Xtczy
  1764.    
  1765. End Sub
  1766. Private Sub Sub_DeleteBill()                                               '删除当前单据
  1767.     Dim YAnswer As Integer               '确认是否删除当前单据
  1768.     Dim jsqte As Long                    '临时使用计数器
  1769.     '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  1770.      If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
  1771.         Exit Sub
  1772.      End If
  1773.    
  1774.     '非有效单据不予进行删除动作
  1775.     If Val(Lab_BillId.Caption) = 0 Then
  1776.         Exit Sub
  1777.     End If
  1778.    
  1779.     Tsxx = "请确认是否删除当前单据?"
  1780.     YAnswer = Xtxxts(Tsxx, 2, 2)
  1781.    
  1782.     If YAnswer = 1 Then
  1783.    
  1784.         '判断当前单据是否允许删除
  1785.         If Not Fun_AllowEdit Then
  1786.             Exit Sub
  1787.         End If
  1788.       
  1789.         '进行事务处理
  1790.         On Error GoTo Swcwcl
  1791.         Cw_DataEnvi.DataConnect.BeginTrans
  1792.         
  1793.         '1.删除单据所有内容
  1794.         '1.删除单据所有内容
  1795.         Dim Rec_Sub As New Recordset
  1796.         Set Rec_Sub = Cw_DataEnvi.DataConnect.Execute("select mnumber,marea,batchnum,FactReceiptQuan from Gy_inoutSub where InOutMainId=" & Val(InID))
  1797.         With Rec_Sub
  1798.             If Not .EOF Then
  1799.                 .MoveFirst
  1800.                 Cw_DataEnvi.DataConnect.Execute ("delete KF_Batch where fathertablenum='" & Val(InID) & "'")
  1801.                 For LsJs = 1 To .RecordCount
  1802.                     StrTemp1 = Trim(.Fields("marea") & "")
  1803.                     '1修改现存量
  1804.                     Cw_DataEnvi.DataConnect.Execute (" KF_SP_ChangeQuan '" & Trim(LrText(5).Tag) & "','" & StrTemp1 & "','" & Trim(.Fields("mnumber")) & "','" & Trim(.Fields("batchnum")) & "'," & Val(.Fields("FactReceiptQuan")) & ",1")
  1805.                     .MoveNext
  1806.                 Next LsJs
  1807.             End If
  1808.         End With
  1809.         If Rec_Sub.State = 1 Then Rec_Sub.Close
  1810.         Set Rec_Sub = Cw_DataEnvi.DataConnect.Execute("select mnumber,marea,batchnum,FactIssueQuan from Gy_inoutSub where InOutMainId=" & Val(OutID))
  1811.         With Rec_Sub
  1812.             If Not .EOF Then
  1813.             
  1814.                 .MoveFirst
  1815.                 For LsJs = 1 To .RecordCount
  1816.                     StrTemp1 = Trim(.Fields("marea") & "")
  1817.                     '1修改现存量
  1818.                     Cw_DataEnvi.DataConnect.Execute (" KF_SP_ChangeQuan '" & Trim(LrText(4).Tag) & "','" & StrTemp1 & "','" & Trim(.Fields("mnumber")) & "','" & Trim(.Fields("batchnum")) & "'," & Val(.Fields("FactIssueQuan")) & ",0")
  1819.                     '4修改实际出库数量
  1820.                     If Trim(.Fields("batchnum") & "") <> "" Then
  1821.                         If BatchJudge(Trim(LrText(4).Tag), Trim(.Fields("mnumber")), Trim(.Fields("batchnum")), intCount, intFatherID(), intChildID(), IsQc(), True) = 0 Then
  1822.                             Call RestoreQuan(intCount, intFatherID(), intChildID(), IsQc(), .Fields("FactIssueQuan"), True)
  1823.                         End If
  1824.                     End If
  1825.                     .MoveNext
  1826.                 Next LsJs
  1827.             End If
  1828.         End With
  1829.         
  1830.         Cw_DataEnvi.DataConnect.Execute ("Delete gy_inoutsub Where inoutMainID=" & Val(InID))
  1831.         Cw_DataEnvi.DataConnect.Execute ("Delete gy_inoutmain Where inoutMainID=" & Val(InID))
  1832.         Cw_DataEnvi.DataConnect.Execute ("Delete gy_inoutsub Where inoutMainID=" & Val(OutID))
  1833.         Cw_DataEnvi.DataConnect.Execute ("Delete gy_inoutmain Where inoutMainID=" & Val(OutID))
  1834.         Cw_DataEnvi.DataConnect.Execute ("Delete KF_MoveSub Where MoveMainID=" & Val(Lab_BillId.Caption))
  1835.         Cw_DataEnvi.DataConnect.Execute ("Delete KF_MoveMain Where MoveMainID=" & Val(Lab_BillId.Caption))
  1836.         
  1837.         Cw_DataEnvi.DataConnect.CommitTrans
  1838.       
  1839.         '标识单据发生改动
  1840.         Bln_BillChange = True
  1841.   
  1842.         '单据ID置0
  1843.         Lab_BillId.Caption = 0
  1844.     Else
  1845.         Exit Sub
  1846.     End If
  1847.     
  1848.    '删除单据后重置状态
  1849.         
  1850.     '1.显示下一张单据
  1851.     Call Sub_next
  1852.         
  1853.     '2.如果无下一张单据则搜索上一张单据
  1854.     If Val(Lab_BillId.Caption) = 0 Then
  1855.         Call Sub_Prev
  1856.     End If
  1857.         
  1858.     '3.如无单据则置单据为空状态
  1859.     If Val(Lab_BillId.Caption) = 0 Then
  1860.         '清除录入文本框
  1861.         For jsqte = Max_Text_Index To 0 Step -1
  1862.             LrText(jsqte).Tag = ""
  1863.             LrText(jsqte).Text = ""
  1864.         Next jsqte
  1865.     
  1866.         '重置网格(Fixed)
  1867.         With WglrGrid
  1868.             .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  1869.             For jsqte = .FixedRows To .Rows - 1
  1870.                 .RowHeight(jsqte) = Sjhgd
  1871.             Next jsqte
  1872.             WglrGrid.Clear 1
  1873.             Changelock = True
  1874.             .Select .FixedRows, Qslz
  1875.             Changelock = False
  1876.         End With
  1877.     
  1878.         '计算合计数据(清零)(Fixed)
  1879.         For jsqte = Qslz To WglrGrid.Cols - 1
  1880.             Call Sjhj(jsqte)
  1881.         Next jsqte
  1882.     
  1883.         '设置操作状态为浏览
  1884.         Lab_OperStatus = "1"
  1885.         Call Sub_OperStatus("10")
  1886.     End If
  1887.     
  1888.     Rec_Query.Requery
  1889.     Rec_Query.Find "MoveMainID=" & Val(Lab_BillId.Caption)
  1890.     Call VisulGrid
  1891.     Exit Sub
  1892.    
  1893. Swcwcl:          '单据删除时出现错误
  1894.     Cw_DataEnvi.DataConnect.RollbackTrans
  1895.     Tsxx = "单据删除过程中出现未知错误,程序自动恢复保存前状态!"
  1896.     Call Xtxxts(Tsxx, 0, 1)
  1897.     Exit Sub
  1898. End Sub
  1899. Private Sub Sub_AbandonBill()                                              '放弃对当前单据的操作
  1900.  
  1901.     Dim jsqte As Long                    '临时使用计数器
  1902.   
  1903.     '先关闭录入载体(Fixed)
  1904.     Changelock = True
  1905.     Valilock = True
  1906.     Call Ycwbk
  1907.     Changelock = False
  1908.     Valilock = False
  1909.     '如果单据有效则重新显示当前单据,置单据为空状态
  1910.     If Not Rec_Query.EOF Then
  1911.         Lab_BillId.Caption = Rec_Query.Fields("MoveMainID")
  1912.         Call Sub_ShowBill
  1913.     Else
  1914.         '单据ID置为0
  1915.         Lab_BillId.Caption = 0
  1916.      
  1917.         '清除录入文本框
  1918.         For jsqte = Max_Text_Index To 0 Step -1
  1919.             LrText(jsqte).Tag = ""
  1920.             LrText(jsqte).Text = ""
  1921.         Next jsqte
  1922.         '重置网格(Fixed)
  1923.         WglrGrid.Clear 1
  1924.         With WglrGrid
  1925.             .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  1926.             For jsqte = .FixedRows To .Rows - 1
  1927.                 .RowHeight(jsqte) = Sjhgd
  1928.             Next jsqte
  1929.             
  1930.             Changelock = True
  1931.             .Select .FixedRows, Qslz
  1932.             Changelock = False
  1933.         End With
  1934.         '计算合计数据(清零)(Fixed)
  1935.         For jsqte = Qslz To WglrGrid.Cols - 1
  1936.             Call Sjhj(jsqte)
  1937.         Next jsqte
  1938.     End If
  1939.     
  1940.     '设置操作状态为浏览
  1941.     Lab_OperStatus = "1"
  1942.     Call Sub_OperStatus("10")
  1943. End Sub
  1944. Private Function Sub_SaveBill() As Boolean                                   '保 存 单 据
  1945.   
  1946.     Dim RecTemp As New ADODB.Recordset                    '临时使用动态集
  1947.     Dim Rec_VouchMain As New ADODB.Recordset              '单据主表动态集
  1948.     Dim Rec_VouchSub As New ADODB.Recordset               '单据子表动态集
  1949.     Dim Rowjsq As Long                                    '网格行计数器
  1950.     Dim Coljsq As Long                                    '网格列计数器
  1951.     Dim jsqte As Integer                                  '临时计数器
  1952.     Dim Lng_RowCount As Long                              '有效数据行计数器
  1953.     Dim Lrywlz As Long                                    '录入有误列值
  1954.     Dim Rec_InMain As New ADODB.Recordset              '单据主表动态集
  1955.     Dim Rec_InSub As New ADODB.Recordset               '单据子表动态集
  1956.     Dim Rec_OutMain As New ADODB.Recordset              '单据主表动态集
  1957.     Dim Rec_OutSub As New ADODB.Recordset               '单据子表动态集
  1958.     Dim Rec_Sub As New ADODB.Recordset
  1959.     Dim Int_Year As Integer
  1960.     Dim Int_Period As Integer
  1961.     Dim strMNum As String
  1962.     Dim strMArea As String
  1963.     Dim strBatch As String
  1964.     Dim strWhCode As String
  1965.     Dim dblEndQuan As Double
  1966.     
  1967.     Sub_SaveBill = False
  1968.   
  1969.     '一.============先对单据内容进行有效性判断==============='
  1970.   
  1971.     '先进行字段不能为空或不能为零有效性判断(Fixed)
  1972.     For jsqte = 0 To Max_Text_Index
  1973.         If Textint(jsqte, 8) = 1 Then     '字段不能为空
  1974.             If Len(Trim(LrText(jsqte).Text)) = 0 Then
  1975.                 Tsxx = Textstr(jsqte, 7) & "不能为空!"
  1976.                 Call Xtxxts(Tsxx, 0, 1)
  1977.                 LrText(jsqte).SetFocus
  1978.                 Exit Function
  1979.             End If
  1980.         Else
  1981.             If Textint(jsqte, 8) = 2 Then   '字段不能为零
  1982.                 If Val(Trim(LrText(jsqte).Text)) = 0 Then
  1983.                     Tsxx = Textstr(jsqte, 7) & "不能为零!"
  1984.                     Call Xtxxts(Tsxx, 0, 1)
  1985.                     LrText(jsqte).SetFocus
  1986.                     Exit Function
  1987.                 End If
  1988.             End If
  1989.         End If
  1990.     Next jsqte
  1991.     
  1992.     '对需要进行事后判断的文本框录入内容进行有效性判断 (Fixed)
  1993.     For jsqte = 0 To Max_Text_Index
  1994.         If Textint(jsqte, 9) = 0 Or Textint(jsqte, 9) = 2 Then
  1995.             If Not TextYxxpd(jsqte) Then
  1996.                 Call TextShow(jsqte)
  1997.                 Exit Function
  1998.             End If
  1999.         End If
  2000.     Next jsqte
  2001.   
  2002.     '[>>
  2003.   
  2004.     '可在此区域写入其他对单据表头内容的有效性判断.
  2005.    
  2006.     '[判断用户所选会计期间是否有效(非结帐月份),且制单日期必须和所选会计期间一致
  2007.     If CheckBillDate(LrText(1), Int_Year, Int_Period) = True Then Exit Function
  2008.     
  2009.     Dim strSQLTemp As String
  2010.     Dim adoRec As New ADODB.Recordset
  2011.     Dim strSQL As String
  2012.     Dim adoRecTemp As New ADODB.Recordset
  2013.     
  2014.     strSQLTemp = "SELECT MAX(Period) AS MaxPeriod FROM GY_kjrlb WHERE kfjzbz=1 and kjyear in (select max(kjyear) from gy_kjrlb)"
  2015.     Set adoRec = Cw_DataEnvi.DataConnect.Execute(strSQLTemp)
  2016.     With adoRec
  2017.         If Not .EOF Then
  2018.             If Not IsNull(.Fields("MaxPeriod")) Then
  2019.                 If .Fields("MaxPeriod") = 12 Then
  2020.                     TempPeriod = 0
  2021.                 Else
  2022.                     TempPeriod = .Fields("MaxPeriod")
  2023.                 End If
  2024.             Else
  2025.                 TempPeriod = 0
  2026.             End If
  2027.         End If
  2028.     End With
  2029.     adoRec.Close
  2030.     Set adoRec = Nothing
  2031.     
  2032.     strSQL = "SELECT * FROM GY_WareHouse WHERE WhCode='" & Trim(LrText(4).Tag) & "'"
  2033.     Set adoRecTemp = Cw_DataEnvi.DataConnect.Execute(strSQL)
  2034.     With adoRecTemp
  2035.         If Not .EOF Then
  2036.             If Month(CDate(LrText(1).Text)) = TempPeriod + 1 Then
  2037.                 If .Fields("EndDealFlagWh") Then
  2038.                     Tsxx = "调出仓库在所选会计期间已经结帐,不能再填制单据!"
  2039.                     Call Xtxxts(Tsxx, 0, 4)
  2040.                     Exit Function
  2041.                 End If
  2042.             End If
  2043.         End If
  2044.     End With
  2045.     adoRecTemp.Close
  2046.     
  2047.     strSQL = "SELECT * FROM GY_WareHouse WHERE WhCode='" & Trim(LrText(5).Tag) & "'"
  2048.     Set adoRecTemp = Cw_DataEnvi.DataConnect.Execute(strSQL)
  2049.     With adoRecTemp
  2050.         If Not .EOF Then
  2051.             If Month(CDate(LrText(1).Text)) = TempPeriod + 1 Then