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

企业管理

开发平台:

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 CL_MakeVoucher 
  5.    Caption         =   "生成凭证"
  6.    ClientHeight    =   6690
  7.    ClientLeft      =   60
  8.    ClientTop       =   345
  9.    ClientWidth     =   10065
  10.    HelpContextID   =   130407
  11.    Icon            =   "处理_生成凭证.frx":0000
  12.    LinkTopic       =   "Form2"
  13.    MDIChild        =   -1  'True
  14.    ScaleHeight     =   6690
  15.    ScaleWidth      =   10065
  16.    Begin VB.PictureBox Pic_Title 
  17.       BackColor       =   &H00FFFFFF&
  18.       Height          =   1035
  19.       Left            =   0
  20.       Picture         =   "处理_生成凭证.frx":1042
  21.       ScaleHeight     =   975
  22.       ScaleWidth      =   11715
  23.       TabIndex        =   4
  24.       Top             =   570
  25.       Width           =   11775
  26.       Begin VB.Label Lab_Title 
  27.          AutoSize        =   -1  'True
  28.          BackColor       =   &H80000018&
  29.          BackStyle       =   0  'Transparent
  30.          Caption         =   "单据列表"
  31.          BeginProperty Font 
  32.             Name            =   "宋体"
  33.             Size            =   12
  34.             Charset         =   134
  35.             Weight          =   700
  36.             Underline       =   0   'False
  37.             Italic          =   0   'False
  38.             Strikethrough   =   0   'False
  39.          EndProperty
  40.          ForeColor       =   &H00000000&
  41.          Height          =   240
  42.          Index           =   4
  43.          Left            =   480
  44.          TabIndex        =   7
  45.          Top             =   210
  46.          Width           =   1020
  47.       End
  48.       Begin VB.Label Lbl_TitleMess 
  49.          AutoSize        =   -1  'True
  50.          BackStyle       =   0  'Transparent
  51.          Caption         =   "月份:"
  52.          Height          =   195
  53.          Index           =   0
  54.          Left            =   750
  55.          TabIndex        =   6
  56.          Top             =   750
  57.          Width           =   405
  58.       End
  59.       Begin VB.Label Lbl_TitleText 
  60.          AutoSize        =   -1  'True
  61.          BackStyle       =   0  'Transparent
  62.          Caption         =   "仓库"
  63.          ForeColor       =   &H00000000&
  64.          Height          =   195
  65.          Index           =   0
  66.          Left            =   1260
  67.          TabIndex        =   5
  68.          Top             =   750
  69.          Width           =   360
  70.       End
  71.    End
  72.    Begin VB.Timer Timer1 
  73.       Enabled         =   0   'False
  74.       Interval        =   1
  75.       Left            =   510
  76.       Top             =   510
  77.    End
  78.    Begin VB.Timer Timer2 
  79.       Interval        =   1
  80.       Left            =   990
  81.       Top             =   510
  82.    End
  83.    Begin VSFlex8Ctl.VSFlexGrid CxbbGrid 
  84.       Height          =   4965
  85.       Left            =   90
  86.       TabIndex        =   0
  87.       Top             =   1800
  88.       Width           =   9885
  89.       _cx             =   5080
  90.       _cy             =   5080
  91.       Appearance      =   1
  92.       BorderStyle     =   1
  93.       Enabled         =   -1  'True
  94.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  95.          Name            =   "MS Sans Serif"
  96.          Size            =   8.25
  97.          Charset         =   0
  98.          Weight          =   400
  99.          Underline       =   0   'False
  100.          Italic          =   0   'False
  101.          Strikethrough   =   0   'False
  102.       EndProperty
  103.       MousePointer    =   0
  104.       BackColor       =   -2147483643
  105.       ForeColor       =   -2147483640
  106.       BackColorFixed  =   -2147483633
  107.       ForeColorFixed  =   -2147483630
  108.       BackColorSel    =   -2147483635
  109.       ForeColorSel    =   -2147483634
  110.       BackColorBkg    =   -2147483636
  111.       BackColorAlternate=   -2147483643
  112.       GridColor       =   -2147483633
  113.       GridColorFixed  =   -2147483632
  114.       TreeColor       =   -2147483632
  115.       FloodColor      =   192
  116.       SheetBorder     =   -2147483642
  117.       FocusRect       =   1
  118.       HighLight       =   1
  119.       AllowSelection  =   -1  'True
  120.       AllowBigSelection=   -1  'True
  121.       AllowUserResizing=   0
  122.       SelectionMode   =   0
  123.       GridLines       =   1
  124.       GridLinesFixed  =   2
  125.       GridLineWidth   =   1
  126.       Rows            =   50
  127.       Cols            =   10
  128.       FixedRows       =   1
  129.       FixedCols       =   1
  130.       RowHeightMin    =   0
  131.       RowHeightMax    =   0
  132.       ColWidthMin     =   0
  133.       ColWidthMax     =   0
  134.       ExtendLastCol   =   0   'False
  135.       FormatString    =   ""
  136.       ScrollTrack     =   0   'False
  137.       ScrollBars      =   3
  138.       ScrollTips      =   0   'False
  139.       MergeCells      =   0
  140.       MergeCompare    =   0
  141.       AutoResize      =   -1  'True
  142.       AutoSizeMode    =   0
  143.       AutoSearch      =   0
  144.       AutoSearchDelay =   2
  145.       MultiTotals     =   -1  'True
  146.       SubtotalPosition=   1
  147.       OutlineBar      =   0
  148.       OutlineCol      =   0
  149.       Ellipsis        =   0
  150.       ExplorerBar     =   0
  151.       PicturesOver    =   0   'False
  152.       FillStyle       =   0
  153.       RightToLeft     =   0   'False
  154.       PictureType     =   0
  155.       TabBehavior     =   0
  156.       OwnerDraw       =   0
  157.       Editable        =   0
  158.       ShowComboButton =   1
  159.       WordWrap        =   0   'False
  160.       TextStyle       =   0
  161.       TextStyleFixed  =   0
  162.       OleDragMode     =   0
  163.       OleDropMode     =   0
  164.       DataMode        =   0
  165.       VirtualData     =   -1  'True
  166.       DataMember      =   ""
  167.       ComboSearch     =   3
  168.       AutoSizeMouse   =   -1  'True
  169.       FrozenRows      =   0
  170.       FrozenCols      =   0
  171.       AllowUserFreezing=   0
  172.       BackColorFrozen =   0
  173.       ForeColorFrozen =   0
  174.       WallPaperAlignment=   9
  175.       AccessibleName  =   ""
  176.       AccessibleDescription=   ""
  177.       AccessibleValue =   ""
  178.       AccessibleRole  =   24
  179.    End
  180.    Begin MSComctlLib.Toolbar SzToolbar 
  181.       Align           =   1  'Align Top
  182.       Height          =   555
  183.       Left            =   0
  184.       TabIndex        =   1
  185.       Top             =   0
  186.       Width           =   10065
  187.       _ExtentX        =   17754
  188.       _ExtentY        =   979
  189.       ButtonWidth     =   820
  190.       ButtonHeight    =   926
  191.       AllowCustomize  =   0   'False
  192.       Appearance      =   1
  193.       Style           =   1
  194.       ImageList       =   "ImageList1"
  195.       _Version        =   393216
  196.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  197.          NumButtons      =   20
  198.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  199.             Caption         =   "设置"
  200.             Key             =   "ymsz"
  201.             ImageKey        =   "sz"
  202.          EndProperty
  203.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  204.             Caption         =   "打印"
  205.             Key             =   "dy"
  206.             ImageKey        =   "dy"
  207.          EndProperty
  208.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  209.             Caption         =   "预览"
  210.             Key             =   "yl"
  211.             ImageKey        =   "yl"
  212.          EndProperty
  213.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  214.             Style           =   3
  215.          EndProperty
  216.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  217.             Caption         =   "单据"
  218.             Key             =   "dj"
  219.             ImageKey        =   "dj"
  220.          EndProperty
  221.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  222.             Style           =   4
  223.          EndProperty
  224.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  225.             Caption         =   "查询"
  226.             Key             =   "cx"
  227.             ImageKey        =   "cx"
  228.          EndProperty
  229.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  230.             Style           =   4
  231.          EndProperty
  232.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  233.             Caption         =   "全选"
  234.             Key             =   "qx"
  235.             ImageKey        =   "qx"
  236.          EndProperty
  237.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  238.             Caption         =   "全消"
  239.             Key             =   "qxi"
  240.             ImageKey        =   "qxi"
  241.          EndProperty
  242.          BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  243.             Style           =   3
  244.          EndProperty
  245.          BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  246.             Caption         =   "生成"
  247.             Key             =   "shc"
  248.             ImageKey        =   "shc"
  249.          EndProperty
  250.          BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  251.             Caption         =   "合成"
  252.             Key             =   "hc"
  253.             ImageKey        =   "hc"
  254.          EndProperty
  255.          BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  256.             Style           =   3
  257.          EndProperty
  258.          BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  259.             Caption         =   "修改"
  260.             Key             =   "xg"
  261.             ImageKey        =   "xg"
  262.          EndProperty
  263.          BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  264.             Caption         =   "删除"
  265.             Key             =   "sc"
  266.             ImageKey        =   "sc"
  267.          EndProperty
  268.          BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  269.             Caption         =   "凭证"
  270.             Key             =   "pz"
  271.             ImageKey        =   "pz"
  272.          EndProperty
  273.          BeginProperty Button18 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  274.             Style           =   3
  275.          EndProperty
  276.          BeginProperty Button19 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  277.             Caption         =   "帮助"
  278.             Key             =   "bz"
  279.             ImageKey        =   "bz"
  280.          EndProperty
  281.          BeginProperty Button20 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  282.             Caption         =   "退出"
  283.             Key             =   "fh"
  284.             ImageKey        =   "tc"
  285.          EndProperty
  286.       EndProperty
  287.       BorderStyle     =   1
  288.       Begin MSComctlLib.Toolbar GsToolbar 
  289.          Height          =   525
  290.          Left            =   7560
  291.          TabIndex        =   3
  292.          Top             =   0
  293.          Width           =   2475
  294.          _ExtentX        =   4366
  295.          _ExtentY        =   926
  296.          ButtonWidth     =   1455
  297.          ButtonHeight    =   926
  298.          Appearance      =   1
  299.          Style           =   1
  300.          ImageList       =   "ImageList1"
  301.          _Version        =   393216
  302.          BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  303.             NumButtons      =   3
  304.             BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  305.                Caption         =   "保存格式"
  306.                Key             =   "bcgs"
  307.                ImageKey        =   "bcgs"
  308.             EndProperty
  309.             BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  310.                Caption         =   "默认列宽"
  311.                Key             =   "hfmrgs"
  312.                ImageKey        =   "mrlk"
  313.             EndProperty
  314.             BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  315.                Caption         =   "显示项目"
  316.                Key             =   "szxsxm"
  317.                ImageKey        =   "xsxm"
  318.             EndProperty
  319.          EndProperty
  320.       End
  321.       Begin VB.Timer Timer3 
  322.          Enabled         =   0   'False
  323.          Left            =   30
  324.          Top             =   510
  325.       End
  326.    End
  327.    Begin MSComctlLib.ImageList ImageList1 
  328.       Left            =   9090
  329.       Top             =   30
  330.       _ExtentX        =   1005
  331.       _ExtentY        =   1005
  332.       BackColor       =   -2147483643
  333.       ImageWidth      =   16
  334.       ImageHeight     =   16
  335.       MaskColor       =   12632256
  336.       _Version        =   393216
  337.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  338.          NumListImages   =   24
  339.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  340.             Picture         =   "处理_生成凭证.frx":35106
  341.             Key             =   "sz"
  342.          EndProperty
  343.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  344.             Picture         =   "处理_生成凭证.frx":354A0
  345.             Key             =   "qx"
  346.          EndProperty
  347.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  348.             Picture         =   "处理_生成凭证.frx":3583A
  349.             Key             =   "qxi"
  350.          EndProperty
  351.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  352.             Picture         =   "处理_生成凭证.frx":35BD4
  353.             Key             =   "pz"
  354.          EndProperty
  355.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  356.             Picture         =   "处理_生成凭证.frx":35F6E
  357.             Key             =   "hc"
  358.          EndProperty
  359.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  360.             Picture         =   "处理_生成凭证.frx":36308
  361.             Key             =   "dy"
  362.          EndProperty
  363.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  364.             Picture         =   "处理_生成凭证.frx":366A2
  365.             Key             =   "yl"
  366.          EndProperty
  367.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  368.             Picture         =   "处理_生成凭证.frx":36A3C
  369.             Key             =   "cx"
  370.          EndProperty
  371.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  372.             Picture         =   "处理_生成凭证.frx":36DD6
  373.             Key             =   "dj"
  374.          EndProperty
  375.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  376.             Picture         =   "处理_生成凭证.frx":37170
  377.             Key             =   "sx"
  378.          EndProperty
  379.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  380.             Picture         =   "处理_生成凭证.frx":3750A
  381.             Key             =   "first"
  382.          EndProperty
  383.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  384.             Picture         =   "处理_生成凭证.frx":378A4
  385.             Key             =   "prev"
  386.          EndProperty
  387.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  388.             Picture         =   "处理_生成凭证.frx":37C3E
  389.             Key             =   "next"
  390.          EndProperty
  391.          BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  392.             Picture         =   "处理_生成凭证.frx":37FD8
  393.             Key             =   "last"
  394.          EndProperty
  395.          BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  396.             Picture         =   "处理_生成凭证.frx":38372
  397.             Key             =   "bz"
  398.          EndProperty
  399.          BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  400.             Picture         =   "处理_生成凭证.frx":3870C
  401.             Key             =   "tc"
  402.          EndProperty
  403.          BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  404.             Picture         =   "处理_生成凭证.frx":38AA6
  405.             Key             =   "bcgs"
  406.          EndProperty
  407.          BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  408.             Picture         =   "处理_生成凭证.frx":38E40
  409.             Key             =   "mrlk"
  410.          EndProperty
  411.          BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  412.             Picture         =   "处理_生成凭证.frx":391DA
  413.             Key             =   "xsxm"
  414.          EndProperty
  415.          BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  416.             Picture         =   "处理_生成凭证.frx":39574
  417.             Key             =   "check"
  418.          EndProperty
  419.          BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  420.             Picture         =   "处理_生成凭证.frx":3990E
  421.             Key             =   "xz"
  422.          EndProperty
  423.          BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  424.             Picture         =   "处理_生成凭证.frx":39CA8
  425.             Key             =   "xg"
  426.          EndProperty
  427.          BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  428.             Picture         =   "处理_生成凭证.frx":3A042
  429.             Key             =   "sc"
  430.          EndProperty
  431.          BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  432.             Picture         =   "处理_生成凭证.frx":3A3DC
  433.             Key             =   "shc"
  434.          EndProperty
  435.       EndProperty
  436.    End
  437.    Begin VB.Label DdtsLabel 
  438.       AutoSize        =   -1  'True
  439.       BackColor       =   &H00C0C0C0&
  440.       BackStyle       =   0  'Transparent
  441.       Caption         =   "正在调入数据,请稍等..."
  442.       BeginProperty Font 
  443.          Name            =   "宋体"
  444.          Size            =   10.5
  445.          Charset         =   134
  446.          Weight          =   400
  447.          Underline       =   0   'False
  448.          Italic          =   0   'False
  449.          Strikethrough   =   0   'False
  450.       EndProperty
  451.       ForeColor       =   &H000000FF&
  452.       Height          =   210
  453.       Left            =   960
  454.       TabIndex        =   2
  455.       Top             =   960
  456.       Visible         =   0   'False
  457.       Width           =   2550
  458.    End
  459. End
  460. Attribute VB_Name = "CL_MakeVoucher"
  461. Attribute VB_GlobalNameSpace = False
  462. Attribute VB_Creatable = False
  463. Attribute VB_PredeclaredId = True
  464. Attribute VB_Exposed = False
  465. '**************************************************************************
  466. '*    模 块 名 称 :生成凭证列表
  467. '*    功 能 描 述 :
  468. '*    程序员姓名  :杨波
  469. '*    最后修改人  :杨波
  470. '*    最后修改时间:2001/12/18
  471. '*    备        注:程序中所有依实际情况自定义部分均用[>>  <<]括起
  472. '**************************************************************************
  473. Dim ReportTitle As String                '报表主标题
  474. Dim Str_QueryCondi As String             '用户录入查询条件
  475. Dim Rec_BillID As New ADODB.Recordset    '用户查询单据ID动态集
  476. '以下为固定使用变量
  477. Dim Dyymctbl As New DY_Dyymsz            '打印页面窗体变量
  478. Dim GridCode As String                   '显示网格网格代码
  479. Dim GridInf() As Variant                 '整个网格设置信息
  480. Dim Tsxx As String                       '系统提示信息
  481. Dim Qslz As Long                         '网格隐藏(非操作显示)列数
  482. Dim Sjhgd As Double                      '网格数据行高度
  483. Dim Sfxshjwg As Boolean                  '是否显示合计网格
  484. Dim GridBoolean() As Boolean             '网格列信息(布尔型)
  485. Dim GridStr()  As String                 '网格列信息(字符型)
  486. Dim GridInt() As Integer                 '网格列信息(整型)
  487. Dim Szzls As Integer                     '数组总列数(网格列数-1)
  488. Dim MListId As String                    '生成凭证单据的ID号条件集
  489. Dim MPzType As Integer                   '0为生成,1为合并生成
  490. Private Sub Form_Resize()                '根据窗体大小来调整网格,标题栏大小(Fixed)
  491.     
  492.     On Error Resume Next
  493.     With CxbbGrid
  494.         .Width = Me.Width - 160
  495.         .Height = Me.Height - .Top - 400
  496.     End With
  497.     With Pic_Title
  498.         .Width = Me.Width - 160
  499.     End With
  500.   
  501.     GsToolbar.Left = Me.Width - GsToolbar.Width - 160
  502.     
  503. End Sub
  504. Private Sub Form_Load()                                                   '窗体装入
  505.     
  506.     '调入打印页面设置窗体
  507.     If CL_MakeVoucherFind.Opti_bill1.Value = True Then
  508.         ReportTitle = "单据列表"
  509.     Else
  510.         ReportTitle = "凭证列表"
  511.     End If
  512.     XtReportCode = "Chhs_MakeVoucher"
  513.     Load Dyymctbl
  514.     
  515.     '调整标题栏及网格、格式工具条位置(Fixed)
  516.     Pic_Title.Left = 40
  517.     Pic_Title.Top = SzToolbar.Top + SzToolbar.Height - 10
  518.     CxbbGrid.Left = Pic_Title.Left
  519.     CxbbGrid.Top = Pic_Title.Top + Pic_Title.Height + 20
  520.     
  521.     '调 入 网 格(Fixed)
  522.     GridCode = "Chhs_MakeVoucher"
  523.     Call BzWgcsh(CxbbGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  524.     
  525.     Qslz = GridInf(1)
  526.     Sjhgd = GridInf(2)
  527.     Sfxshjwg = GridInf(7)
  528.     Szzls = CxbbGrid.Cols - 1
  529.     
  530.     Lbl_TitleText(0) = CStr(Xtyear) + "." + CStr(PGNowmon)
  531.     
  532. End Sub
  533. Private Sub Form_Unload(Cancel As Integer)                                  '窗体卸载
  534.     
  535.     '卸载条件窗体
  536.     CL_MakeVoucherFind.UnloadCheck.Value = 1
  537.     Unload CL_MakeVoucherFind
  538.     
  539.     '卸载打印页面设置窗体
  540.     Unload Dyymctbl
  541.     
  542. End Sub
  543. Private Sub CxbbGrid_BeforeMoveColumn(ByVal Col As Long, Position As Long)           '网格列发生移动时自动交换网格索引信息
  544.     
  545.     Call FnBln_RefreshArray(Col, Position, GridStr(), GridInf())
  546.     
  547. End Sub
  548. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)                '网格格式调整(Fixed)
  549.     
  550.     Select Case Button.Key
  551.     Case "bcgs"                                          '保存表格格式
  552.         Call Bcwggs(CxbbGrid, GridCode, GridStr())
  553.     Case "hfmrgs"                                        '恢复默认格式
  554.         Call Hfmrgs(CxbbGrid, GridCode, GridStr())
  555.     Case "szxsxm"                                        '设置显示项目
  556.         Call Szxsxm(CxbbGrid, GridCode)
  557.     End Select
  558.     
  559. End Sub
  560. Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
  561.     
  562.     Dim count As Integer
  563.     Dim countsub As Integer
  564.     Dim IsInType As Boolean
  565.     Dim IsOutType As Boolean
  566.     Dim IsType As Boolean
  567.     Dim Rectemp As New ADODB.Recordset
  568.     
  569.     Select Case Button.Key
  570.         
  571.         Case "ymsz"                                          '页面设置
  572.             Dyymctbl.Show 1
  573.         Case "yl"                                            '预 览
  574.             Call bbyl(True)
  575.         Case "dy"                                            '打 印
  576.             Call bbyl(False)
  577.         Case "shc"                                           '生成
  578.             MListId = ""
  579.             MPzType = 0
  580.             Call MakePz
  581.         Case "hc"                                            '合成
  582.             MListId = ""
  583.             MPzType = 1
  584.             For count = CxbbGrid.FixedRows To CxbbGrid.Rows - CxbbGrid.FixedRows
  585.                 If CxbbGrid.TextMatrix(count, Sydz("001", GridStr(), Szzls)) Then
  586.                     For countsub = CxbbGrid.FixedRows To CxbbGrid.Rows - CxbbGrid.FixedRows
  587.                         If CxbbGrid.TextMatrix(countsub, Sydz("001", GridStr(), Szzls)) Then
  588.                             If CxbbGrid.TextMatrix(count, 7) = CxbbGrid.TextMatrix(countsub, 7) Then
  589.                                 IsType = False
  590.                             Else
  591.                                 IsType = True
  592.                                 Exit For
  593.                             End If
  594.                         End If
  595.                     Next countsub
  596.                     If IsType Then
  597.                         Exit For
  598.                     End If
  599.                 End If
  600.             Next count
  601.             If IsType Then
  602.                 Tsxx = "出、入库单据不能合并生成"
  603.                 Call Xtxxts(Tsxx, 0, 4)
  604.             Else
  605.                 Call MakePz
  606.             End If
  607.             
  608.         Case "qx"                                            '全选
  609.             For count = CxbbGrid.FixedRows To CxbbGrid.Rows - CxbbGrid.FixedRows
  610.                 CxbbGrid.TextMatrix(count, Sydz("001", GridStr(), Szzls)) = 1
  611.             Next
  612.             
  613.         Case "qxi"                                           '全消
  614.             For count = CxbbGrid.FixedRows To CxbbGrid.Rows - CxbbGrid.FixedRows
  615.                 CxbbGrid.TextMatrix(count, Sydz("001", GridStr(), Szzls)) = 0
  616.             Next
  617.             
  618.         Case "dj"                                             '显示单据
  619.         
  620.             If CxbbGrid.Rows <> CxbbGrid.FixedRows Then
  621.                 Call ShowBill
  622.             End If
  623.             
  624.         Case "sc"
  625.             Call Sub_DelVouch
  626.         Case "xg"
  627.             If CxbbGrid.Rows = CxbbGrid.FixedRows Then
  628.                 Exit Sub
  629.             End If
  630.             CL_PzFrm.Timer1.Enabled = True
  631.             CL_PzFrm.lbl_Tag = "3"
  632.             CL_PzFrm.Lab_VouchId = Val(CxbbGrid.TextMatrix(CxbbGrid.Row, 10))
  633.             CL_PzFrm.Show 1
  634.         Case "pz"
  635.             If CxbbGrid.Rows = CxbbGrid.FixedRows Then
  636.                 Exit Sub
  637.             End If
  638.             
  639.             Set Rectemp = Cw_DataEnvi.DataConnect.Execute("Select vouchid from chhs_list where VouchId=" & Val(CxbbGrid.TextMatrix(CxbbGrid.Row, 10)) & "")
  640.             If Rectemp.EOF Then
  641.                 Tsxx = "此凭证已被其他用户删除!"
  642.                 Call Xtxxts(Tsxx, 0, 4)
  643.                 Exit Sub
  644.             End If
  645.             
  646.             CL_PzFrm.Timer1.Enabled = True
  647.             CL_PzFrm.lbl_Tag = "2"
  648.             CL_PzFrm.Lab_VouchId = Val(CxbbGrid.TextMatrix(CxbbGrid.Row, 10))
  649.             CL_PzFrm.Show 1
  650.             
  651.         Case "cx"                                             '查询
  652.             CL_MakeVoucherFind.Show 1
  653.         Case "bz"                                             '帮 助
  654.             Call F1bz
  655.         Case "fh"                                             '退 出
  656.             Unload Me
  657.     End Select
  658.     
  659. End Sub
  660. Private Sub Timer1_Timer()                                 '在窗体激活后调入查询程序
  661.     
  662.     Timer1.Enabled = False
  663.     Xt_Wait.Show
  664.     Xt_Wait.Refresh
  665.     
  666.     '加快显示速度
  667.     CxbbGrid.Redraw = False
  668.     
  669.     '生成查询结果
  670.     Call Sub_Query
  671.     
  672.     CxbbGrid.Redraw = True
  673.     
  674.     Xt_Wait.Hide
  675.     
  676. End Sub
  677. Private Sub Sub_Query()                                     '生成查询结果(Define)
  678.     
  679.     Dim Rec_Query As New ADODB.Recordset        '查询结果动态集
  680.     Dim Str_QueryCondi As String                '用户录入查询条件
  681.     Dim SqlStr As String                        '查询字符串
  682.     Dim Coljsq As Long                          '网格列计数器
  683.     Dim Jsqte As Integer                        '临时动态计数器
  684.     Dim VouchNoValue As String                  '记录上一张凭证标识
  685.     Dim count As Integer
  686.     Dim billtype_flag As Boolean
  687.     
  688.     Dim BillNumValue As String
  689.     Dim WhNameValue As String
  690.     Dim BillNameValue As String
  691.  
  692.     '以下为用户自定义部分[
  693.     With CL_MakeVoucherFind
  694.         
  695.         If CL_MakeVoucherFind.Opti_bill1.Value Then
  696.             Str_QueryCondi = "SELECT * FROM Chhs_V_List LEFT OUTER JOIN Gy_Whlimit ON Chhs_V_List.WhCode = Gy_Whlimit.WhCode WHERE Gy_Whlimit.Czybm='" & Xtczybm & "' AND Vouchid=0 AND KjYear='" & PGKjYear & "' AND Period='" & PGNowmon & "' AND StartFlag<>1 "
  697.             CxbbGrid.ColHidden(Sydz("001", GridStr(), Szzls)) = False
  698.             Call Sub_OperStatus("0")
  699.         Else
  700.             If CL_MakeVoucherFind.Opti_bill2.Value Then
  701.                 Str_QueryCondi = "SELECT * FROM Chhs_V_List LEFT OUTER JOIN Gy_Whlimit ON Chhs_V_List.WhCode = Gy_Whlimit.WhCode WHERE Gy_Whlimit.Czybm='" & Xtczybm & "' AND Vouchid<>0 AND KjYear='" & PGKjYear & "' AND Period='" & PGNowmon & "'"
  702.                 CxbbGrid.ColHidden(Sydz("001", GridStr(), Szzls)) = True
  703.                 Call Sub_OperStatus("1")
  704.             End If
  705.         End If
  706.         
  707.         For Jsqte = 1 To 8
  708.             
  709.             Select Case Jsqte
  710.                 
  711.                 Case 1    '仓库
  712.                     If Trim(.LrText(0).Text) <> "" Then
  713.                         Str_QueryCondi = Str_QueryCondi & " AND Chhs_V_List.WhCode='" & Trim(.LrText(0).Tag) & "'"
  714.                     End If
  715.                     
  716.                 Case 2    '存货分类
  717.                     If Trim(.LrText(1).Text) <> "" Then
  718.                         Str_QueryCondi = Str_QueryCondi & " AND InvSortcode like '" & Trim(.LrText(1).Tag) & "%'"
  719.                     End If
  720.                     
  721.                 Case 3    '存货编码
  722.                     If Trim(.LrText(2).Text) <> "" Then
  723.                         Str_QueryCondi = Str_QueryCondi & " AND MNumber ='" & Trim(.LrText(2).Text) & "'"
  724.                     End If
  725.                     
  726.                 Case 4    '日期
  727.                     If Trim(.LrText(3).Text) <> "" Then
  728.                         Str_QueryCondi = Str_QueryCondi & " And Chhs_V_List.BillDate>=' " & Trim(.LrText(3).Text) & "'"
  729.                     End If
  730.                 Case 5    '日期
  731.                     If Trim(.LrText(4).Text) <> "" Then
  732.                         Str_QueryCondi = Str_QueryCondi & " And Chhs_V_List.BillDate<=' " & Trim(.LrText(4).Text) & "'"
  733.                     End If
  734.                     
  735.                 Case 6    '部门
  736.                     If Trim(.LrText(5).Text) <> "" Then
  737.                         Str_QueryCondi = Str_QueryCondi & " AND DeptCode='" & Trim(.LrText(5).Tag) & "'"
  738.                     End If
  739.                     
  740.                 Case 7   '记帐人
  741.                     If Trim(.LrText(6).Text) <> "" Then
  742.                         Str_QueryCondi = Str_QueryCondi & " AND ChalkitupMan='" & Trim(.LrText(6).Text) & "'"
  743.                     End If
  744.                 
  745.                 Case 8
  746.                     Str_QueryCondi = Str_QueryCondi + CL_MakeVoucherFind.SqlStr
  747.                     
  748.             End Select
  749.             
  750.         Next Jsqte
  751.         
  752.         Str_QueryCondi = Str_QueryCondi + " ORDER BY BiLLCode+Chhs_V_List.WhCode+BillNum"
  753.         
  754.     End With
  755.     Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Str_QueryCondi)
  756.     
  757.     With Rec_Query
  758.     
  759.         CxbbGrid.Rows = CxbbGrid.FixedRows
  760.         Jsqte = CxbbGrid.FixedRows
  761.         
  762.         Do While Not .EOF
  763.         
  764.             If CL_MakeVoucherFind.Opti_bill1.Value Then
  765.             
  766.                 BillNumValue = Trim(CxbbGrid.TextMatrix(Jsqte - 1, Sydz("002", GridStr(), Szzls)))
  767.                 WhNameValue = Trim(CxbbGrid.TextMatrix(Jsqte - 1, Sydz("005", GridStr(), Szzls)))
  768.                 BillNameValue = Trim(CxbbGrid.TextMatrix(Jsqte - 1, Sydz("009", GridStr(), Szzls)))
  769.                 
  770.                 If Not (BillNumValue = Trim(.Fields("BillNum")) And WhNameValue = Trim(.Fields("WhName")) And BillNameValue = Trim(.Fields("BillName"))) Then
  771.                     
  772.                     If Jsqte >= CxbbGrid.Rows Then
  773.                         CxbbGrid.AddItem ""
  774.                     End If
  775.                  
  776.                     CxbbGrid.TextMatrix(Jsqte, 1) = Val(.Fields("ListID"))                  '单据ID
  777.                     CxbbGrid.TextMatrix(Jsqte, 2) = Val(.Fields("InoutSubId"))              '收发记录子表ID
  778.                     CxbbGrid.TextMatrix(Jsqte, 3) = Trim(.Fields("WhCode"))                 '仓库编码
  779.                     CxbbGrid.TextMatrix(Jsqte, 4) = Val(.Fields("InoutAdjustSubId"))        '调整单子表ID
  780.     '                CxbbGrid.TextMatrix(Jsqte, 5) = Val(.Fields("receipt_id"))             '材料入库单子表ID
  781.                     CxbbGrid.TextMatrix(Jsqte, 6) = Trim(.Fields("BillCode"))               '单据类型
  782.                     CxbbGrid.TextMatrix(Jsqte, 7) = Trim(.Fields("InoutFlag"))              '收发标志
  783.                     If Trim(.Fields("BillCode")) = "1307" Then
  784.                         CxbbGrid.TextMatrix(Jsqte, 8) = Trim(.Fields("ListId") & "")        '明细帐ID
  785.                     Else
  786.                         CxbbGrid.TextMatrix(Jsqte, 8) = Trim(.Fields("InoutMainId") & "")   '收发记录主表ID
  787.                     End If
  788.                     CxbbGrid.TextMatrix(Jsqte, 9) = Val(.Fields("InoutAdjustMainId"))       '调整单主表ID
  789.                     CxbbGrid.TextMatrix(Jsqte, 10) = Val(.Fields("vouchId"))                '凭证ID
  790.                         
  791.                     '如果为同一张凭证则不再输出制单日期和凭证号
  792.                     
  793.                     CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = 0                                     '选择
  794.                     CxbbGrid.TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = .Fields("BillNum")                    '单据号
  795.                     CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = Format(Trim(.Fields("ChalkDate") & ""), "yyyy-mm-dd")       '记帐日期
  796.                     CxbbGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Format(Trim(.Fields("BillDate") & ""), "yyyy-mm-dd")        '单据日期
  797.                     CxbbGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("WhName") & "")          '仓库
  798.                     CxbbGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("ChalkitupMan") & "")    '记帐人
  799.                     CxbbGrid.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = Trim(.Fields("InOutClassName") & "")  '收发类别
  800.                     If .Fields("vouchId") <> 0 Then
  801.                         CxbbGrid.TextMatrix(Jsqte, Sydz("008", GridStr(), Szzls)) = Mid(Trim(Str(10000 + .Fields("vouchNO"))), 2, 4)                '凭证号
  802.                     End If
  803.                     CxbbGrid.TextMatrix(Jsqte, Sydz("009", GridStr(), Szzls)) = Trim(.Fields("BillName"))             '单据类型
  804.                     
  805.                     CxbbGrid.RowHeight(Jsqte) = Sjhgd
  806.                     Jsqte = Jsqte + 1
  807.                 End If
  808.             Else
  809.                 BillNumValue = Trim(CxbbGrid.TextMatrix(Jsqte - 1, Sydz("002", GridStr(), Szzls)))
  810.                 VouchNoValue = Trim(CxbbGrid.TextMatrix(Jsqte - 1, Sydz("008", GridStr(), Szzls)))
  811.                 BillNameValue = Trim(CxbbGrid.TextMatrix(Jsqte - 1, Sydz("009", GridStr(), Szzls)))
  812.                 
  813.                 If Not (BillNumValue = Trim(.Fields("BillNum")) And Val(VouchNoValue) = Trim(.Fields("vouchNO")) And BillNameValue = Trim(.Fields("BillName"))) Then
  814.                     If Jsqte >= CxbbGrid.Rows Then
  815.                         CxbbGrid.AddItem ""
  816.                     End If
  817.                  
  818.                     CxbbGrid.TextMatrix(Jsqte, 1) = Val(.Fields("ListID"))                  '单据ID
  819.                     CxbbGrid.TextMatrix(Jsqte, 2) = Val(.Fields("InoutSubId"))              '收发记录子表ID
  820.                     CxbbGrid.TextMatrix(Jsqte, 3) = Trim(.Fields("WhCode"))                 '仓库编码
  821.                     CxbbGrid.TextMatrix(Jsqte, 4) = Val(.Fields("InoutAdjustSubId"))        '调整单子表ID
  822.     '                CxbbGrid.TextMatrix(Jsqte, 5) = Val(.Fields("receipt_id"))             '材料入库单子表ID
  823.                     CxbbGrid.TextMatrix(Jsqte, 6) = Trim(.Fields("BillCode"))               '单据类型
  824.                     CxbbGrid.TextMatrix(Jsqte, 7) = Trim(.Fields("InoutFlag"))              '收发标志
  825.                     If Trim(.Fields("BillCode")) = "1307" Then
  826.                         CxbbGrid.TextMatrix(Jsqte, 8) = Trim(.Fields("ListId") & "")        '明细帐ID
  827.                     Else
  828.                         CxbbGrid.TextMatrix(Jsqte, 8) = Trim(.Fields("InoutMainId") & "")   '收发记录主表ID
  829.                     End If
  830.                     CxbbGrid.TextMatrix(Jsqte, 9) = Val(.Fields("InoutAdjustMainId"))       '调整单主表ID
  831.                     CxbbGrid.TextMatrix(Jsqte, 10) = Val(.Fields("vouchId"))                '凭证ID
  832.                         
  833.                     '如果为同一张凭证则不再输出制单日期和凭证号
  834.                     
  835.                     CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = 0                                     '选择
  836.                     CxbbGrid.TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = .Fields("BillNum")                    '单据号
  837.                     CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = Format(Trim(.Fields("ChalkDate") & ""), "yyyy-mm-dd")       '记帐日期
  838.                     CxbbGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Format(Trim(.Fields("BillDate") & ""), "yyyy-mm-dd")        '单据日期
  839.                     CxbbGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("WhName") & "")          '仓库
  840.                     CxbbGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("ChalkitupMan") & "")    '记帐人
  841.                     CxbbGrid.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = Trim(.Fields("InOutClassName") & "")  '收发类别
  842.                     If .Fields("vouchId") <> 0 And Not IsNull(.Fields("vouchNO")) Then
  843.                         CxbbGrid.TextMatrix(Jsqte, Sydz("008", GridStr(), Szzls)) = Mid(Trim(Str(10000 + .Fields("vouchNO"))), 2, 4)                '凭证号
  844.                     End If
  845.                     CxbbGrid.TextMatrix(Jsqte, Sydz("009", GridStr(), Szzls)) = Trim(.Fields("BillName"))             '单据类型
  846.                     
  847.                     CxbbGrid.RowHeight(Jsqte) = Sjhgd
  848.                     Jsqte = Jsqte + 1
  849.                     
  850.                 End If
  851.             End If
  852.             
  853.             .MoveNext
  854.             
  855.         Loop
  856.         
  857.     End With
  858.     
  859.     ']以上为用户自定义部分
  860.     
  861. End Sub
  862. Private Sub CxbbGrid_DblClick()                                              '用户双击网格调入相应单据
  863.     
  864.     '非数据行退出
  865.     If CxbbGrid.Row < CxbbGrid.FixedRows Then
  866.         Exit Sub
  867.     End If
  868.     If CL_MakeVoucherFind.Opti_bill1 Then
  869.         If CxbbGrid.TextMatrix(CxbbGrid.Row, Sydz("001", GridStr(), Szzls)) Then
  870.             CxbbGrid.TextMatrix(CxbbGrid.Row, Sydz("001", GridStr(), Szzls)) = 0
  871.         Else
  872.             CxbbGrid.TextMatrix(CxbbGrid.Row, Sydz("001", GridStr(), Szzls)) = 1
  873.         End If
  874.     End If
  875.     
  876. End Sub
  877. Private Sub Sub_AddBill()                                              '新增单据
  878.     
  879.     With MS_FrmDjsDdlr
  880.         
  881.         '设置单据处理为填制单据状态
  882.         Xtcdcs = "1"
  883.         
  884.         .Show 1
  885.     End With
  886.     
  887.     If Xtfhcs = "1" Then
  888.         Tsxx = "销售订单发生变化,是否刷新销售订单列表?"
  889.         yhAnswer = Xtxxts(Tsxx, 2, 2)
  890.         If yhAnswer = 1 Then
  891.             Xt_Wait.Show
  892.             Xt_Wait.Refresh
  893.             
  894.             '加快显示速度
  895.             CxbbGrid.Redraw = False
  896.             
  897.             '生成查询结果
  898.             Call Sub_Query
  899.             
  900.             CxbbGrid.Redraw = True
  901.             Xt_Wait.Hide
  902.         End If
  903.     End If
  904.     
  905. End Sub
  906. Private Sub Sub_DeleteBill()                                            '删除选中当前销售订单
  907.     
  908.     Dim YAnswer As Integer
  909.     Dim Lng_BillID As Long           '单据标识
  910.     
  911.     '非数据行退出
  912.     If CxbbGrid.Row < CxbbGrid.FixedRows Or Val(CxbbGrid.TextMatrix(CxbbGrid.Row, 0)) = 0 Then
  913.         Exit Sub
  914.     End If
  915.     
  916.     Tsxx = "请确认是否删除当前销售订单?"
  917.     yhAnswer = Xtxxts(Tsxx, 2, 2)
  918.     
  919.     If yhAnswer = 1 Then
  920.         '1.判断当前销售订单是否允许删除
  921.         If Not Fun_AllowDelete Then
  922.             Exit Sub
  923.         End If
  924.         
  925.         '2.删除单据所有内容
  926.         Lng_BillID = Val(CxbbGrid.TextMatrix(CxbbGrid.Row, 0))
  927.         On Error GoTo Swcwcl
  928.         Cw_DataEnvi.DataConnect.BeginTrans
  929.         Cw_DataEnvi.DataConnect.Execute ("Delete XS_OrderBillMain Where OrderBillMainId=" & Lng_BillID)        '删除单据主表内容
  930.         Cw_DataEnvi.DataConnect.Execute ("Delete XS_OrderBillSub Where OrderBillMainId=" & Lng_BillID)         '删除单据子表内容
  931.         Cw_DataEnvi.DataConnect.CommitTrans
  932.         
  933.         '删除网格中单据数据
  934.         Jsqte = CxbbGrid.FixedRows
  935.         Do While Jsqte <= CxbbGrid.Rows - 1
  936.             If Val(CxbbGrid.TextMatrix(Jsqte, 0)) = Lng_BillID Then
  937.                 CxbbGrid.RemoveItem (CxbbGrid.Row)
  938.             Else
  939.                 Jsqte = Jsqte + 1
  940.             End If
  941.         Loop
  942.     Else
  943.         Exit Sub
  944.     End If
  945.     Exit Sub
  946. Swcwcl:
  947.     Cw_DataEnvi.DataConnect.RollbackTrans
  948.     Tsxx = "删除销售订单过程中出现未知错误,程序自动恢复删除前状态!"
  949.     Call Xtxxts(Tsxx, 0, 1)
  950.     Exit Sub
  951.     
  952. End Sub
  953. Private Function Fun_AllowDelete() As Boolean                                        '判断当前单据是否允许删除
  954.     
  955.     Dim Rectemp As New ADODB.Recordset     '临时使用动态集
  956.     Dim SqlStr As String                   '查询字符串
  957.     Dim Lng_BillID As Long                 '单据ID
  958.     
  959.     Lng_BillID = Val(CxbbGrid.TextMatrix(CxbbGrid.Row, 0))
  960.     SqlStr = "Select Checker From XS_OrderBillMain Where OrderBillMainId=" & Lng_BillID
  961.     Set Rectemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  962.     With Rectemp
  963.         If Not .EOF Then
  964.             If Trim(.Fields("Checker") & "") <> "" Then
  965.                 Tsxx = "该销售订单已审核确认,不能删除!"
  966.                 Call Xtxxts(Tsxx, 0, 4)
  967.                 Exit Function
  968.             End If
  969.         End If
  970.     End With
  971.     Fun_AllowDelete = True
  972.     
  973. End Function
  974. Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
  975.     
  976.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  977.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  978.     Bbxbtgs = 1                                          '报 表 小 标 题 行 数
  979.     Bbbwhgs = 0                                          '报 表 表 尾 行 数
  980.     ReDim Bbxbt(1 To Bbxbtgs)
  981.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  982.     If Bbbwhgs <> 0 Then
  983.         ReDim Bbbwh(1 To Bbbwhgs)
  984.         ReDim Bbbwhzzxs(1 To Bbbwhgs)
  985.     End If
  986.     Bbzbt = ReportTitle
  987.     Bbxbt(1) = ""
  988.     bbxbtzzxs(1) = 0                                     '报表行组织形式(0-居左 1-居中 2-居右)
  989.     Call Scyxsjb(CxbbGrid)                               '生成报表数据
  990.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  991.     If Not bbylte Then
  992.         Unload DY_Tybbyldy
  993.     End If
  994.     
  995. End Sub
  996. Private Sub Sub_OperStatus(Str_Status As String)
  997.     
  998.     Select Case Str_Status
  999.         Case "0"
  1000.             SzToolbar.Buttons("qx").Enabled = True
  1001.             SzToolbar.Buttons("qxi").Enabled = True
  1002.             SzToolbar.Buttons("shc").Enabled = True
  1003.             SzToolbar.Buttons("hc").Enabled = True
  1004.             SzToolbar.Buttons("xg").Enabled = False
  1005.             SzToolbar.Buttons("sc").Enabled = False
  1006.             SzToolbar.Buttons("pz").Enabled = False
  1007.         
  1008.         Case "1"
  1009.             SzToolbar.Buttons("xg").Enabled = True
  1010.             SzToolbar.Buttons("sc").Enabled = True
  1011.             SzToolbar.Buttons("pz").Enabled = True
  1012.             SzToolbar.Buttons("qx").Enabled = False
  1013.             SzToolbar.Buttons("qxi").Enabled = False
  1014.             SzToolbar.Buttons("shc").Enabled = False
  1015.             SzToolbar.Buttons("hc").Enabled = False
  1016.             
  1017.     End Select
  1018.     
  1019. End Sub
  1020. Private Sub ShowBill()
  1021.     Dim Rectemp As New ADODB.Recordset
  1022.     Dim Load_Form As Form
  1023.     Dim BillCode As String
  1024.     Dim SqlStr As String
  1025.     
  1026.     If Trim(CxbbGrid.TextMatrix(CxbbGrid.Row, 8)) = "" Then
  1027.         Tsxx = "此单据已被其他用户删除!"
  1028.         Call Xtxxts(Tsxx, 0, 4)
  1029.         Exit Sub
  1030.     End If
  1031.     BillCode = Trim(CxbbGrid.TextMatrix(CxbbGrid.Row, 6))
  1032.     
  1033.     If BillCode = "1301" Or BillCode = "1302" Then
  1034.         SqlStr = "SELECT InOutAdjustMainId From Chhs_InOutAdjustMain Where InOutAdjustMainId=" & Val(CxbbGrid.TextMatrix(CxbbGrid.Row, 9)) + 0
  1035.     ElseIf BillCode = "1303" Then
  1036.         SqlStr = "SELECT PlanAdjustMainId From Chhs_PlanAdjustMain Where PlanAdjustMainId=" & Val(CxbbGrid.TextMatrix(CxbbGrid.Row, 9)) + 0
  1037.     ElseIf BillCode = "1307" Then
  1038.         SqlStr = "SELECT DiffBillId From Chhs_DiffBill Where whcode='" & Trim(CxbbGrid.TextMatrix(CxbbGrid.Row, 3)) & "'AND Chhs_DiffBill.KjYear=" & PGKjYear & ""
  1039.     Else
  1040.         SqlStr = "SELECT InOutMainId From Gy_InOutMain Where InOutMainId=" & Val(CxbbGrid.TextMatrix(CxbbGrid.Row, 8)) + 0
  1041.     End If
  1042.     
  1043.     Set Rectemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  1044.     If Rectemp.EOF Then
  1045.         Tsxx = "此单据已被其他用户删除!"
  1046.         Call Xtxxts(Tsxx, 0, 4)
  1047.         Exit Sub
  1048.     End If
  1049.         
  1050.     '根据单据类型和主表ID号显示单据
  1051.     Select Case BillCode
  1052.         
  1053.         Case "1212"      '材料入库单
  1054.             Set Load_Form = DJ_MateInBill
  1055.             
  1056.         Case "1202"      '产品入库单
  1057.             Set Load_Form = DJ_ProdInBill
  1058.           
  1059.         Case "1203"      '其它入库单
  1060.             Set Load_Form = DJ_OtherInBill
  1061.             
  1062.         Case "1204"      '材料出库单
  1063.             Set Load_Form = DJ_MateOutBill
  1064.         
  1065.         Case "1205"      '销售出库单
  1066.             Set Load_Form = DJ_SellOutBill
  1067.           
  1068.         Case "1206"      '其它出库单
  1069.             Set Load_Form = DJ_OtherOutBill
  1070.         
  1071.         Case "1301"      '入库单调整
  1072.             Set Load_Form = DJ_AdjustInbill
  1073.           
  1074.         Case "1302"      '出库单调整
  1075.             Set Load_Form = DJ_AdjustOutBill
  1076.             
  1077.         Case "1303"      '计划调整单
  1078.             Set Load_Form = DJ_AdjustPlan
  1079.             
  1080.         Case "1304"      '蓝字暂估单
  1081.             Set Load_Form = Eval_BlueBill
  1082.             Xtcdcsfz = "StartFlag=0 and Kjyear='" & PGKjYear & "' and Period='" & PGNowmon & "' "
  1083.             
  1084.         Case "1305"      '红字回冲单
  1085.             Set Load_Form = Eval_RedBill
  1086.             Xtcdcsfz = "StartFlag=0 and Kjyear='" & PGKjYear & "' and Period='" & PGNowmon & "' "
  1087.         
  1088.         Case "1307"      '差异结转单
  1089.             
  1090.             Set Load_Form = CL_DiscrepancyChange
  1091.             
  1092.         Case Else
  1093.             Exit Sub
  1094.     End Select
  1095.     
  1096.     Xtcdcs = "3"
  1097.     Select Case BillCode
  1098.         Case "1301", "1302", "1303"
  1099.             XT_BillID = CxbbGrid.TextMatrix(CxbbGrid.Row, 9)
  1100.             Xtcdcsfz = XT_BillID
  1101.         Case "1307"
  1102.             CL_DiscrepancyChange.lbl_Tstext(0) = CStr(PGKjYear) + "." + Str(PGNowmon)
  1103.             CL_DiscrepancyChange.lbl_Tstext(0).Tag = PGNowmon
  1104.             CL_DiscrepancyChange.Query_Cond = "Chhs_v_DiffBill.whcode='" & Trim(CxbbGrid.TextMatrix(CxbbGrid.Row, 3)) & "' AND Chhs_v_DiffBill.KjYear=" & PGKjYear
  1105.         Case Else
  1106.             XT_BillID = CxbbGrid.TextMatrix(CxbbGrid.Row, 8)
  1107.     End Select
  1108.     
  1109.     Load_Form.Show 1
  1110.     Set Load_Form = Nothing
  1111. End Sub
  1112. '生成凭证前进行判断
  1113. Private Sub MakePz()
  1114.     Dim count As Integer
  1115.     For count = CxbbGrid.FixedRows To CxbbGrid.Rows - CxbbGrid.FixedRows
  1116.         If CxbbGrid.TextMatrix(count, Sydz("001", GridStr(), Szzls)) Then
  1117.             If InStr(1, "1301,1302,1303,1304,1305", CxbbGrid.TextMatrix(count, 6)) = 0 And Val(CxbbGrid.TextMatrix(count, 8)) = 0 Then
  1118.                 Tsxx = "单据号为:" & CxbbGrid.TextMatrix(count, Sydz("002", GridStr(), Szzls)) & "  仓库为:" & CxbbGrid.TextMatrix(count, Sydz("005", GridStr(), Szzls)) & ",在收发记录中不存在"
  1119.                 Call Xtxxts(Tsxx, 0, 4)
  1120.                 Exit Sub
  1121.             End If
  1122.             If Trim(MListId) = "" Then
  1123.                 Select Case CxbbGrid.TextMatrix(count, 6)
  1124.                     Case "1301", "1302", "1303"
  1125.                         MListId = MListId + "InoutAdjustMainId= " & CxbbGrid.TextMatrix(count, 9) & ""
  1126.                     Case "1307"
  1127.                         MListId = MListId + "ListId= " & CxbbGrid.TextMatrix(count, 8) & ""
  1128.                     Case Else
  1129.                         MListId = MListId + "InoutMainId= " & CxbbGrid.TextMatrix(count, 8) & ""
  1130.                 End Select
  1131.             Else
  1132.                 Select Case CxbbGrid.TextMatrix(count, 6)
  1133.                     Case "1301", "1302", "1303"
  1134.                         MListId = MListId + " or InoutAdjustMainId= " & CxbbGrid.TextMatrix(count, 9) & ""
  1135.                     Case "1307"
  1136.                         MListId = MListId + " or ListId= " & CxbbGrid.TextMatrix(count, 8) & ""
  1137.                     Case Else
  1138.                         MListId = MListId + " or InoutMainId= " & CxbbGrid.TextMatrix(count, 8) & ""
  1139.                 End Select
  1140.             End If
  1141.         End If
  1142.     Next
  1143.     
  1144.     MListId = "(" & MListId & ")"
  1145.     
  1146.     If Trim(MListId) <> "()" Then
  1147.         CL_MakeVoucherSub.Show 1
  1148.     Else
  1149.         Tsxx = "请先选择要生成凭证的单据"
  1150.         Call Xtxxts(Tsxx, 0, 4)
  1151.     End If
  1152. End Sub
  1153. '删除凭证
  1154. Private Sub Sub_DelVouch()
  1155.     
  1156.     Dim VouchId As Long
  1157.     Dim ListId As Long
  1158.     Dim Jsqte As Long
  1159.     Dim yhAnswer As Integer
  1160.     
  1161.     '不能删除凭证的条件
  1162.     If CxbbGrid.Rows = CxbbGrid.FixedRows Then
  1163.         Exit Sub
  1164.     End If
  1165.     
  1166.     '删除凭证
  1167.     
  1168.     VouchId = Val(CxbbGrid.TextMatrix(CxbbGrid.Row, 10))
  1169.     
  1170.     Tsxx = "请确认是否删除当前单据?"
  1171.     yhAnswer = Xtxxts(Tsxx, 2, 2)
  1172.     If yhAnswer = 1 Then
  1173.        
  1174.         Cw_DataEnvi.DataConnect.BeginTrans
  1175.        
  1176.         '删除单据内容
  1177.         Cw_DataEnvi.DataConnect.Execute ("DELETE chhs_VouchSub WHERE VouchId=" & VouchId & "")
  1178.         Cw_DataEnvi.DataConnect.Execute ("DELETE Chhs_VouchMain WHERE VouchId=" & VouchId & "")
  1179.         
  1180.        
  1181.         '删除网格行
  1182.         Do While Jsqte <= CxbbGrid.Rows - CxbbGrid.FixedRows
  1183.             If Val(CxbbGrid.TextMatrix(Jsqte, 10)) = VouchId Then
  1184.                 ListId = Val(CxbbGrid.TextMatrix(Jsqte, 1))
  1185.                 Cw_DataEnvi.DataConnect.Execute ("UPDATE Chhs_list SET Vouchid=0 WHERE ListID=" & ListId & "")
  1186.                 CxbbGrid.RemoveItem (Jsqte)
  1187.             Else
  1188.                   Jsqte = Jsqte + 1
  1189.             End If
  1190.         Loop
  1191.               
  1192.        Tsxx = "删除完毕!"
  1193.        Call Xtxxts(Tsxx, 0, 4)
  1194.               
  1195.        Cw_DataEnvi.DataConnect.CommitTrans
  1196.               
  1197.    End If
  1198.     
  1199.     
  1200. End Sub
  1201. Public Property Get ListId() As Variant
  1202.     ListId = MListId
  1203. End Property
  1204. Public Property Get PzType() As Integer
  1205.     PzType = MPzType
  1206. End Property