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

企业管理

开发平台:

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_FrmOutList 
  5.    Caption         =   "出库汇总表"
  6.    ClientHeight    =   8595
  7.    ClientLeft      =   315
  8.    ClientTop       =   390
  9.    ClientWidth     =   11820
  10.    HelpContextID   =   1219007
  11.    Icon            =   "统计分析_出库汇总.frx":0000
  12.    KeyPreview      =   -1  'True
  13.    LinkTopic       =   "Form1"
  14.    MDIChild        =   -1  'True
  15.    ScaleHeight     =   8595
  16.    ScaleWidth      =   11820
  17.    WindowState     =   2  'Maximized
  18.    Begin MSComctlLib.ImageList ImageList1 
  19.       Left            =   5760
  20.       Top             =   0
  21.       _ExtentX        =   1005
  22.       _ExtentY        =   1005
  23.       BackColor       =   -2147483643
  24.       ImageWidth      =   16
  25.       ImageHeight     =   16
  26.       MaskColor       =   12632256
  27.       _Version        =   393216
  28.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  29.          NumListImages   =   18
  30.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  31.             Picture         =   "统计分析_出库汇总.frx":1042
  32.             Key             =   "sz"
  33.          EndProperty
  34.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  35.             Picture         =   "统计分析_出库汇总.frx":13DC
  36.             Key             =   "dy"
  37.          EndProperty
  38.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  39.             Picture         =   "统计分析_出库汇总.frx":1776
  40.             Key             =   "yl"
  41.          EndProperty
  42.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  43.             Picture         =   "统计分析_出库汇总.frx":1B10
  44.             Key             =   "cx"
  45.          EndProperty
  46.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  47.             Picture         =   "统计分析_出库汇总.frx":1EAA
  48.             Key             =   "dj"
  49.          EndProperty
  50.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  51.             Picture         =   "统计分析_出库汇总.frx":2244
  52.             Key             =   "sx"
  53.          EndProperty
  54.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  55.             Picture         =   "统计分析_出库汇总.frx":25DE
  56.             Key             =   "first"
  57.          EndProperty
  58.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  59.             Picture         =   "统计分析_出库汇总.frx":2978
  60.             Key             =   "prev"
  61.          EndProperty
  62.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  63.             Picture         =   "统计分析_出库汇总.frx":2D12
  64.             Key             =   "next"
  65.          EndProperty
  66.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  67.             Picture         =   "统计分析_出库汇总.frx":30AC
  68.             Key             =   "last"
  69.          EndProperty
  70.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  71.             Picture         =   "统计分析_出库汇总.frx":3446
  72.             Key             =   "bz"
  73.          EndProperty
  74.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  75.             Picture         =   "统计分析_出库汇总.frx":37E0
  76.             Key             =   "tc"
  77.          EndProperty
  78.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  79.             Picture         =   "统计分析_出库汇总.frx":3B7A
  80.             Key             =   "bcgs"
  81.          EndProperty
  82.          BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  83.             Picture         =   "统计分析_出库汇总.frx":3F14
  84.             Key             =   "mrlk"
  85.          EndProperty
  86.          BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  87.             Picture         =   "统计分析_出库汇总.frx":42AE
  88.             Key             =   "xsxm"
  89.          EndProperty
  90.          BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  91.             Picture         =   "统计分析_出库汇总.frx":4648
  92.             Key             =   "xz"
  93.          EndProperty
  94.          BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  95.             Picture         =   "统计分析_出库汇总.frx":49E2
  96.             Key             =   ""
  97.          EndProperty
  98.          BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  99.             Picture         =   "统计分析_出库汇总.frx":4D7C
  100.             Key             =   "sc"
  101.          EndProperty
  102.       EndProperty
  103.    End
  104.    Begin MSComctlLib.Toolbar GsToolbar 
  105.       Height          =   525
  106.       Left            =   9195
  107.       TabIndex        =   4
  108.       Top             =   30
  109.       Width           =   2595
  110.       _ExtentX        =   4577
  111.       _ExtentY        =   926
  112.       ButtonWidth     =   1455
  113.       ButtonHeight    =   926
  114.       AllowCustomize  =   0   'False
  115.       Appearance      =   1
  116.       Style           =   1
  117.       ImageList       =   "ImageList1"
  118.       _Version        =   393216
  119.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  120.          NumButtons      =   3
  121.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  122.             Caption         =   "保存格式"
  123.             Key             =   "bcgs"
  124.             ImageKey        =   "bcgs"
  125.          EndProperty
  126.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  127.             Caption         =   "默认列宽"
  128.             Key             =   "hfmrgs"
  129.             ImageKey        =   "mrlk"
  130.          EndProperty
  131.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  132.             Caption         =   "显示项目"
  133.             Key             =   "szxsxm"
  134.             ImageKey        =   "xsxm"
  135.          EndProperty
  136.       EndProperty
  137.    End
  138.    Begin VB.PictureBox Pic_Title 
  139.       BackColor       =   &H00FFFFFF&
  140.       Height          =   1065
  141.       Left            =   0
  142.       Picture         =   "统计分析_出库汇总.frx":5116
  143.       ScaleHeight     =   1005
  144.       ScaleWidth      =   11715
  145.       TabIndex        =   2
  146.       Top             =   570
  147.       Width           =   11775
  148.       Begin VB.Label Label1 
  149.          AutoSize        =   -1  'True
  150.          BackStyle       =   0  'Transparent
  151.          Caption         =   "会计期间:"
  152.          Height          =   180
  153.          Left            =   825
  154.          TabIndex        =   5
  155.          Top             =   705
  156.          Width           =   810
  157.       End
  158.       Begin VB.Label tsLabel 
  159.          AutoSize        =   -1  'True
  160.          BackColor       =   &H80000018&
  161.          BackStyle       =   0  'Transparent
  162.          Caption         =   "出库汇总表"
  163.          BeginProperty Font 
  164.             Name            =   "宋体"
  165.             Size            =   14.25
  166.             Charset         =   134
  167.             Weight          =   700
  168.             Underline       =   0   'False
  169.             Italic          =   0   'False
  170.             Strikethrough   =   0   'False
  171.          EndProperty
  172.          ForeColor       =   &H00000000&
  173.          Height          =   285
  174.          Index           =   4
  175.          Left            =   495
  176.          TabIndex        =   3
  177.          Top             =   150
  178.          Width           =   1500
  179.       End
  180.    End
  181.    Begin VB.Timer Timer1 
  182.       Enabled         =   0   'False
  183.       Interval        =   1
  184.       Left            =   7620
  185.       Top             =   90
  186.    End
  187.    Begin VSFlex8Ctl.VSFlexGrid CxbbGrid 
  188.       Height          =   6975
  189.       Left            =   0
  190.       TabIndex        =   0
  191.       Top             =   1680
  192.       Width           =   11775
  193.       _cx             =   5080
  194.       _cy             =   5080
  195.       Appearance      =   1
  196.       BorderStyle     =   1
  197.       Enabled         =   -1  'True
  198.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  199.          Name            =   "宋体"
  200.          Size            =   9
  201.          Charset         =   134
  202.          Weight          =   400
  203.          Underline       =   0   'False
  204.          Italic          =   0   'False
  205.          Strikethrough   =   0   'False
  206.       EndProperty
  207.       MousePointer    =   0
  208.       BackColor       =   16777215
  209.       ForeColor       =   -2147483640
  210.       BackColorFixed  =   13826538
  211.       ForeColorFixed  =   -2147483630
  212.       BackColorSel    =   -2147483635
  213.       ForeColorSel    =   -2147483634
  214.       BackColorBkg    =   -2147483636
  215.       BackColorAlternate=   16777215
  216.       GridColor       =   -2147483633
  217.       GridColorFixed  =   -2147483632
  218.       TreeColor       =   -2147483632
  219.       FloodColor      =   192
  220.       SheetBorder     =   -2147483642
  221.       FocusRect       =   1
  222.       HighLight       =   1
  223.       AllowSelection  =   -1  'True
  224.       AllowBigSelection=   -1  'True
  225.       AllowUserResizing=   0
  226.       SelectionMode   =   0
  227.       GridLines       =   1
  228.       GridLinesFixed  =   2
  229.       GridLineWidth   =   1
  230.       Rows            =   50
  231.       Cols            =   10
  232.       FixedRows       =   1
  233.       FixedCols       =   1
  234.       RowHeightMin    =   0
  235.       RowHeightMax    =   0
  236.       ColWidthMin     =   0
  237.       ColWidthMax     =   0
  238.       ExtendLastCol   =   0   'False
  239.       FormatString    =   ""
  240.       ScrollTrack     =   0   'False
  241.       ScrollBars      =   3
  242.       ScrollTips      =   0   'False
  243.       MergeCells      =   0
  244.       MergeCompare    =   0
  245.       AutoResize      =   -1  'True
  246.       AutoSizeMode    =   0
  247.       AutoSearch      =   0
  248.       AutoSearchDelay =   2
  249.       MultiTotals     =   -1  'True
  250.       SubtotalPosition=   1
  251.       OutlineBar      =   0
  252.       OutlineCol      =   0
  253.       Ellipsis        =   0
  254.       ExplorerBar     =   0
  255.       PicturesOver    =   0   'False
  256.       FillStyle       =   0
  257.       RightToLeft     =   0   'False
  258.       PictureType     =   0
  259.       TabBehavior     =   0
  260.       OwnerDraw       =   0
  261.       Editable        =   0
  262.       ShowComboButton =   1
  263.       WordWrap        =   0   'False
  264.       TextStyle       =   0
  265.       TextStyleFixed  =   0
  266.       OleDragMode     =   0
  267.       OleDropMode     =   0
  268.       DataMode        =   0
  269.       VirtualData     =   -1  'True
  270.       DataMember      =   ""
  271.       ComboSearch     =   3
  272.       AutoSizeMouse   =   -1  'True
  273.       FrozenRows      =   0
  274.       FrozenCols      =   0
  275.       AllowUserFreezing=   0
  276.       BackColorFrozen =   0
  277.       ForeColorFrozen =   0
  278.       WallPaperAlignment=   9
  279.       AccessibleName  =   ""
  280.       AccessibleDescription=   ""
  281.       AccessibleValue =   ""
  282.       AccessibleRole  =   24
  283.    End
  284.    Begin MSComctlLib.Toolbar SzToolbar 
  285.       Align           =   1  'Align Top
  286.       Height          =   555
  287.       Left            =   0
  288.       TabIndex        =   1
  289.       Top             =   0
  290.       Width           =   11820
  291.       _ExtentX        =   20849
  292.       _ExtentY        =   979
  293.       ButtonWidth     =   820
  294.       ButtonHeight    =   926
  295.       AllowCustomize  =   0   'False
  296.       Appearance      =   1
  297.       Style           =   1
  298.       ImageList       =   "ImageList1"
  299.       _Version        =   393216
  300.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  301.          NumButtons      =   9
  302.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  303.             Caption         =   "设置"
  304.             Key             =   "ymsz"
  305.             ImageKey        =   "sz"
  306.          EndProperty
  307.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  308.             Caption         =   "打印"
  309.             Key             =   "dy"
  310.             ImageKey        =   "dy"
  311.          EndProperty
  312.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  313.             Caption         =   "预览"
  314.             Key             =   "yl"
  315.             ImageKey        =   "yl"
  316.          EndProperty
  317.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  318.             Style           =   3
  319.          EndProperty
  320.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  321.             Caption         =   "查询"
  322.             Key             =   "cx"
  323.             ImageKey        =   "cx"
  324.          EndProperty
  325.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  326.             Object.Visible         =   0   'False
  327.             Caption         =   "刷新"
  328.             Key             =   "sx"
  329.             ImageKey        =   "sx"
  330.          EndProperty
  331.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  332.             Style           =   3
  333.          EndProperty
  334.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  335.             Caption         =   "帮助"
  336.             Key             =   "bz"
  337.             ImageKey        =   "bz"
  338.          EndProperty
  339.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  340.             Caption         =   "退出"
  341.             Key             =   "fh"
  342.             ImageKey        =   "tc"
  343.          EndProperty
  344.       EndProperty
  345.       BorderStyle     =   1
  346.    End
  347. End
  348. Attribute VB_Name = "KF_FrmOutList"
  349. Attribute VB_GlobalNameSpace = False
  350. Attribute VB_Creatable = False
  351. Attribute VB_PredeclaredId = True
  352. Attribute VB_Exposed = False
  353. '**************************************************************************
  354. '*    模 块 名 称 :出库汇总表
  355. '*    功 能 描 述 :
  356. '*    程序员姓名  : 赵宇光
  357. '*    最后修改人  : 赵宇光
  358. '*    最后修改时间:2001/12/18
  359. '*    备        注:程序中所有依实际情况自定义部分均用[>>  <<]括起
  360. '**************************************************************************
  361. Dim ReportTitle As String                '报表主标题
  362. '以下为固定使用变量
  363. Dim Dyymctbl As New DY_Dyymsz            '打印页面窗体变量
  364. Dim GridCode As String                   '显示网格网格代码
  365. Dim GridInf() As Variant                 '整个网格设置信息
  366. Dim Tsxx As String                       '系统提示信息
  367. Dim Qslz As Long                         '网格隐藏(非操作显示)列数
  368. Dim Sjhgd As Double                      '网格数据行高度
  369. Dim Sfxshjwg As Boolean                  '是否显示合计网格
  370. Dim GridBoolean() As Boolean             '网格列信息(布尔型)
  371. Dim GridStr()  As String                 '网格列信息(字符型)
  372. Dim GridInt() As Integer                 '网格列信息(整型)
  373. Dim Szzls As Integer                     '数组总列数(网格列数-1)
  374. Private Sub Form_Resize()                '根据窗体大小来调整网格,标题栏大小
  375.     On Error Resume Next
  376.     With CxbbGrid
  377.       .Width = Me.Width - 160
  378.       .Height = Me.Height - .Top - 400
  379.     End With
  380.     With Pic_Title
  381.       .Width = Me.Width - 160
  382.     End With
  383.     
  384.     GsToolbar.Left = Me.Width - GsToolbar.Width - 160
  385. End Sub
  386. Private Sub Form_Load()                                                   '窗体装出
  387.     
  388.      '调出打印页面设置窗体
  389.      
  390.      XtReportCode = "KF_OutList"
  391.      Load Dyymctbl
  392.      ReportTitle = "出库汇总表"
  393.      
  394.     '调整标题栏及网格、格式工具条位置
  395.      Pic_Title.Left = 40
  396.      Pic_Title.Top = SzToolbar.Top + SzToolbar.Height - 10
  397.      CxbbGrid.Left = Pic_Title.Left
  398.      CxbbGrid.Top = Pic_Title.Top + Pic_Title.Height + 20
  399.     
  400.     '调 出 网 格
  401.      GridCode = "KF_OutList"
  402.      Call BzWgcsh(CxbbGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  403.      
  404.      Qslz = GridInf(1)
  405.      Sjhgd = GridInf(2)
  406.      Sfxshjwg = GridInf(7)
  407.      Szzls = CxbbGrid.Cols - 1
  408. End Sub
  409. Private Sub Form_Unload(Cancel As Integer)                                  '窗体卸载
  410.    '卸载条件窗体
  411.     KF_FrmOutListQuery.UnloadCheck.Value = 1
  412.     Unload KF_FrmOutListQuery
  413.    '卸载打印页面设置窗体
  414.    Unload Dyymctbl
  415. End Sub
  416. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)       '网格格式调整
  417.     Select Case Button.Key
  418.         Case "bcgs"                                          '保存表格格式
  419.             Call Bcwggs(CxbbGrid, GridCode, GridStr())
  420.         Case "hfmrgs"                                        '恢复默认格式
  421.             Call Hfmrgs(CxbbGrid, GridCode, GridStr())
  422.         Case "szxsxm"                                        '设置显示项目
  423.             Call Szxsxm(CxbbGrid, GridCode)
  424.     End Select
  425. End Sub
  426. Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
  427.     Select Case Button.Key
  428.         Case "ymsz"                                          '页面设置
  429.             Dyymctbl.Show 1
  430.         Case "yl"                                            '预 览
  431.            Call bbyl(True)
  432.         Case "dy"                                            '打 印
  433.           Call bbyl(False)
  434.         Case "cx"                                            '查 询
  435.           KF_FrmOutListQuery.Show 1
  436.         Case "sx"                                            '刷 新
  437.           Call Timer1_Timer
  438.         Case "bz"                                            '帮 助
  439.           Call F1bz
  440.         Case "fh"                                            '退 出
  441.          Unload Me
  442.      End Select
  443. End Sub
  444. Private Sub Timer1_Timer()                                 '在窗体激活后调出查询程序
  445.    Timer1.Enabled = False
  446.    Xt_Wait.Show
  447.    Xt_Wait.Refresh
  448.    
  449.    '加快显示速度
  450.    CxbbGrid.Redraw = False
  451.    '生成查询结果
  452.    Call Sub_Query
  453.    
  454.    CxbbGrid.Redraw = True
  455.     
  456.    Xt_Wait.Hide
  457. End Sub
  458. Private Sub Sub_Query()                                    '生成查询结果
  459.     Dim Rec_Query As New ADODB.Recordset        '查询结果动态集
  460.     Dim Str_QueryCondi As String                '用户录出查询条件
  461.     Dim Sqlstr As String                        '查询字符串
  462.     Dim Coljsq As Long                          '网格列计数器
  463.     Dim jsqte As Long                           '临时动态计数器
  464.     Dim Xtyear As Integer, Period As Integer
  465.     Dim strGroup As String
  466.     Dim dblSumQuan As Double
  467.     Dim dblSumMoney As Double
  468.     Dim tempCol As Integer
  469.     Dim Rec_Mate As New Recordset
  470.     Dim strWhCodeSelect As String
  471.     Dim tmpJsq As Integer
  472.     With KF_FrmOutListQuery
  473.     
  474.         '显示隐藏相应网格列
  475.         Select Case .Combo1.ListIndex
  476.             Case 0      '物料
  477.                 Str_QueryCondi = "SELECT SUM(factIssuequan) AS OutQuan,SUM(IssueMoney) AS OutMoney,MNumber,MName,Model,PrimaryUnitName FROM KF_V_InOutList WHERE InOutFlag=0"
  478.                 strGroup = " GROUP BY MNumber,MName,Model,PrimaryUnitName"
  479.                 tempCol = 2
  480.                 CxbbGrid.ColHidden(Sydz("001", GridStr(), Szzls)) = True            '客户
  481.                 CxbbGrid.ColHidden(Sydz("002", GridStr(), Szzls)) = True            '部门
  482.             Case 1      '客户+物料
  483.                 Str_QueryCondi = "SELECT SUM(factIssuequan) AS OutQuan,SUM(IssueMoney) AS OutMoney,MNumber,CusCode,CusName,MName,Model,PrimaryUnitName FROM KF_V_InOutList WHERE InOutFlag=0 AND CusCode IS NOT NULL"
  484.                 strGroup = " GROUP BY CusCode,CusName,MNumber,MName,Model,PrimaryUnitName"
  485.                 tempCol = 0
  486.                 CxbbGrid.ColHidden(Sydz("002", GridStr(), Szzls)) = True
  487.                 CxbbGrid.ColHidden(Sydz("001", GridStr(), Szzls)) = False            '客户
  488.             Case 2      '部门+物料
  489.                 Str_QueryCondi = "SELECT SUM(factIssuequan) AS OutQuan,SUM(IssueMoney) AS OutMoney,MNumber,DeptCode,DeptName,MName,Model,PrimaryUnitName FROM KF_V_InOutList WHERE InOutFlag=0 AND DeptCode IS NOT NULL"
  490.                 strGroup = " GROUP BY DeptCode,DeptName,MNumber,MName,Model,PrimaryUnitName"
  491.                 tempCol = 1
  492.                 CxbbGrid.ColHidden(Sydz("001", GridStr(), Szzls)) = True
  493.                 CxbbGrid.ColHidden(Sydz("002", GridStr(), Szzls)) = False            '部门
  494.         End Select
  495.      
  496.         '显示查询会计期间
  497.         For jsqte = 1 To 7
  498.             Select Case jsqte
  499.               
  500.                 Case 1  '会计期间
  501.                     If Trim(.Combo_Kjqj2.Text) <> "" Then
  502.                         Xtyear = Val(Mid(Trim(.Combo_Kjqj2.Text), 1, 4))
  503.                         Period = Val(Mid(Trim(.Combo_Kjqj2.Text), 6))
  504.                         Str_QueryCondi = Str_QueryCondi & " AND kjyear=" & Xtyear & " and Period between " & Val(Mid(Trim(.Combo_Kjqj1.Text), 6)) & " and " & Period
  505.                     End If
  506.               
  507.                 Case 2   '仓库
  508.                     strWhCodeSelect = ""
  509.                     For tmpJsq = 0 To .Lst_Check.ListCount - 1
  510.                         If .Lst_Check.Selected(tmpJsq) Then
  511.                             strWhCodeSelect = strWhCodeSelect & "'" & Mid(Trim(.Lst_Check.List(tmpJsq)), 1, 4) & "',"
  512.                         End If
  513.                     Next tmpJsq
  514.                     
  515.                     Str_QueryCondi = Str_QueryCondi & " and WhCode in (" & Mid(Trim(strWhCodeSelect), 1, (Len(strWhCodeSelect) - 1)) & ")"
  516.              
  517.                 Case 3   '物料分类
  518.                     If Trim(.LrText(0).Text) <> "" Then
  519.                         Str_QueryCondi = Str_QueryCondi & " and invsortcode LIKE '" & Trim(.LrText(0).Tag) & "%'"
  520.                     End If
  521.                 
  522.                 Case 4   '材料
  523.                     If Trim(.LrText(1).Text) <> "" Then
  524.                         If Trim(.LrText(2).Text) <> "" Then
  525.                             Str_QueryCondi = Str_QueryCondi & " and mnumber between '" & Trim(.LrText(1).Text) & "' and '" & Trim(.LrText(2).Text) & "'"
  526.                         Else
  527.                             Str_QueryCondi = Str_QueryCondi & " and mnumber>='" & Trim(.LrText(1).Text) & "'"
  528.                         End If
  529.                     Else
  530.                        If Trim(.LrText(2).Text) <> "" Then
  531.                           Str_QueryCondi = Str_QueryCondi & " and mnumber<='" & Trim(.LrText(2).Text) & "'"
  532.                        End If
  533.                     End If
  534.                 Case 5   '客户
  535.                     If Trim(.LrText(3).Text) <> "" Then
  536.                         Str_QueryCondi = Str_QueryCondi & " and  CusCode='" & Trim(.LrText(3).Tag) & "'"
  537.                     End If
  538.                     
  539.                 Case 6   '部门
  540.                     If Trim(.LrText(4).Text) <> "" Then
  541.                         Str_QueryCondi = Str_QueryCondi & " and  DeptCode='" & Trim(.LrText(4).Tag) & "'"
  542.                     End If
  543.                 Case 7  '日期
  544.                     If Trim(.LrText(5).Text) <> "" Then
  545.                         If Trim(.LrText(6).Text) <> "" Then
  546.                             Str_QueryCondi = Str_QueryCondi & " and billdate between '" & CDate(Trim(.LrText(5).Text)) & "' and '" & CDate(Trim(.LrText(6).Text)) & "'"
  547.                         Else
  548.                             Str_QueryCondi = Str_QueryCondi & " and billdate>='" & CDate(Trim(.LrText(5).Text)) & "'"
  549.                         End If
  550.                     Else
  551.                        If Trim(.LrText(6).Text) <> "" Then
  552.                           Str_QueryCondi = Str_QueryCondi & " and billdate<='" & CDate(Trim(.LrText(6).Text)) & "'"
  553.                        Else
  554.                        End If
  555.                     End If
  556.             End Select
  557.         Next jsqte
  558.     End With
  559.     
  560.     Label1 = "会计期间:   " & Trim(KF_FrmOutListQuery.Combo_Kjqj1.Text) & "----" & Trim(KF_FrmOutListQuery.Combo_Kjqj2.Text)
  561.     dblSumQuan = 0
  562.     dblSumMoney = 0
  563.     
  564.     Str_QueryCondi = Str_QueryCondi & strGroup
  565.     Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Str_QueryCondi)
  566.     
  567.     CxbbGrid.Rows = CxbbGrid.FixedRows
  568.     jsqte = CxbbGrid.FixedRows
  569.     With Rec_Query
  570.         If Not .EOF Then
  571.             .MoveFirst
  572.             Do While Not .EOF
  573.                 CxbbGrid.AddItem ""
  574.                 If CxbbGrid.ColHidden(Sydz("001", GridStr(), Szzls)) = False Then
  575.                     CxbbGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("CusName") & "")           '客户
  576.                 End If
  577.                 If CxbbGrid.ColHidden(Sydz("002", GridStr(), Szzls)) = False Then
  578.                     CxbbGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("DeptName") & "")          '部门
  579.                 End If
  580.                 CxbbGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("MNumber"))                    '物料编码
  581.                 CxbbGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("MName"))                      '物料名称
  582.                 CxbbGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("Model") & "")
  583.                 CxbbGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("PrimaryUnitName"))            '计量单位
  584.                 If Val(.Fields("OutQuan")) <> 0 Then
  585.                     CxbbGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = Val(.Fields("OutQuan"))                 '出库数量
  586.                     dblSumQuan = dblSumQuan + Val(.Fields("OutQuan"))
  587.                 Else
  588.                     CxbbGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = ""
  589.                 End If
  590.                 If Val(.Fields("OutMoney")) <> 0 Then
  591.                     CxbbGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = Val(.Fields("OutMoney"))                '出库金额
  592.                     dblSumMoney = dblSumMoney + Val(.Fields("OutMoney"))
  593.                 Else
  594.                     CxbbGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = ""
  595.                 End If
  596.                 
  597.                 CxbbGrid.RowHeight(jsqte) = Sjhgd
  598.                 jsqte = jsqte + 1
  599.                 .MoveNext
  600.             Loop
  601.         End If
  602.     End With
  603.     CxbbGrid.AddItem ""
  604.     CxbbGrid.TextMatrix(jsqte, tempCol) = "合计"
  605.     If dblSumQuan <> 0 Then
  606.         CxbbGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = dblSumQuan                                          '合计数量
  607.     End If
  608.     If dblSumMoney <> 0 Then
  609.         CxbbGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = dblSumMoney                                         '合计金额
  610.     End If
  611.     CxbbGrid.RowHeight(CxbbGrid.Rows - 1) = Sjhgd
  612.  ']以上为用户自定义部分
  613.    
  614. End Sub
  615. Private Sub CxbbGrid_BeforeMoveColumn(ByVal Col As Long, Position As Long)
  616.     '如果结束列小于用户定义网格开始列,则结束列=用户定义网格开始列
  617.     '因为开始列以前的列都是隐藏列,由于要把当前开始移动列移动到隐藏列上
  618.     '所以控件自动把隐藏列变为显示列,这样在刷新数据时,会把隐藏列上的数据
  619.     '显示出来,并且,由于开始列以前的隐藏列在XT_Grid中,不对应逻辑值,所以在保存
  620.     '网格格式时会出错
  621.     If Col > Position Then
  622.       If Position < GridInf(1) Then Position = GridInf(1)
  623.     Else
  624.       If Col < GridInf(1) Then Col = GridInf(1)
  625.     End If
  626.     Call FnBln_RefreshArray(Col, Position, GridStr(), GridInf())
  627. End Sub
  628. Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
  629.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  630.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  631.     Bbxbtgs = 2                                          '报 表 小 标 题 行 数
  632.     Bbbwhgs = 0                                          '报 表 表 尾 行 数
  633.     ReDim Bbxbt(1 To Bbxbtgs)
  634.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  635.     If Bbbwhgs <> 0 Then
  636.        ReDim Bbbwh(1 To Bbbwhgs)
  637.        ReDim Bbbwhzzxs(1 To Bbbwhgs)
  638.     End If
  639.     Bbzbt = ReportTitle
  640.     
  641.     Bbxbt(2) = Space(5) + Fun_FormatOutPut(Trim(Label1), 30)
  642.     
  643.     Bbxbt(1) = " "
  644.     bbxbtzzxs(1) = 0                                     '报表行组织形式(0-居左 1-居中 2-居右)
  645.     Call Scyxsjb(CxbbGrid)                               '生成报表数据
  646.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  647.     If Not bbylte Then
  648.        Unload DY_Tybbyldy
  649.     End If
  650. End Sub