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

企业管理

开发平台:

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