www.pudn.com > vb-sql-server.rar > frmInquireMINGXI2.frm, change:2003-12-16,size:9154b


VERSION 5.00 
Begin VB.Form frmInquireMINGXI2  
   BorderStyle     =   3  'Fixed Dialog 
   Caption         =   "库存信息查询——分类明细" 
   ClientHeight    =   1452 
   ClientLeft      =   48 
   ClientTop       =   336 
   ClientWidth     =   3780 
   LinkTopic       =   "Form1" 
   MaxButton       =   0   'False 
   MinButton       =   0   'False 
   ScaleHeight     =   1452 
   ScaleWidth      =   3780 
   ShowInTaskbar   =   0   'False 
   StartUpPosition =   1  'CenterOwner 
   Begin VB.CheckBox chkItem  
      Caption         =   "Check1" 
      Height          =   180 
      Index           =   0 
      Left            =   120 
      TabIndex        =   7 
      TabStop         =   0   'False 
      Top             =   120 
      Value           =   1  'Checked 
      Width           =   132 
   End 
   Begin VB.CheckBox chkItem  
      Caption         =   "Check1" 
      Height          =   180 
      Index           =   1 
      Left            =   120 
      TabIndex        =   6 
      TabStop         =   0   'False 
      Top             =   480 
      Width           =   132 
   End 
   Begin VB.ComboBox Combo1  
      Height          =   315 
      Index           =   1 
      Left            =   1800 
      Style           =   2  'Dropdown List 
      TabIndex        =   4 
      Top             =   480 
      Width           =   1812 
   End 
   Begin VB.ComboBox Combo1  
      Height          =   315 
      Index           =   0 
      Left            =   1800 
      Style           =   2  'Dropdown List 
      TabIndex        =   3 
      Top             =   120 
      Width           =   1812 
   End 
   Begin VB.CommandButton cmdOk  
      Caption         =   "确定 (&O)" 
      Default         =   -1  'True 
      Height          =   375 
      Left            =   360 
      TabIndex        =   0 
      Top             =   960 
      Width           =   1215 
   End 
   Begin VB.CommandButton cmdExit  
      Caption         =   "取消 (&X)" 
      Height          =   375 
      Left            =   1800 
      TabIndex        =   1 
      Top             =   960 
      Width           =   1215 
   End 
   Begin VB.Label lblitem  
      Caption         =   "按产品名称:" 
      Height          =   255 
      Index           =   0 
      Left            =   480 
      TabIndex        =   5 
      Top             =   480 
      Width           =   1215 
   End 
   Begin VB.Label lblitem  
      Caption         =   "按仓库名称:" 
      Height          =   255 
      Index           =   2 
      Left            =   480 
      TabIndex        =   2 
      Top             =   120 
      Width           =   1095 
   End 
End 
Attribute VB_Name = "frmInquireMINGXI2" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Option Explicit 
'用于传递查询块 
 
 
 
Private Sub chkItem_Click(Index As Integer) 
    If Index = 0 Then 
        Combo1(0).SetFocus 
    ElseIf Index = 1 Then 
        Combo1(1).SetFocus 
    End If 
End Sub 
 
Private Sub cmdExit_Click() 
    Me.Hide 
End Sub 
 
Private Sub cmdOK_Click() 
 
    Dim dBeginDate As String 
    Dim dEndDate As String 
    Dim sQSql As String 
     
    If chkItem(0).Value = vbChecked Then 
        If chkItem(1).Value = vbChecked Then 
            sQSql = "select  kucun.update_date,dm_ck.mc,dm_wz.mc,kucun.s_w,kucun.sl,kucun.total_je from kucun inner join dm_wz on kucun.wzdm = dm_wz.dm inner join dm_ck on kucun.ckdm = dm_ck.dm where kucun.s_w = '0' and dm_ck.mc = '" & Trim(Combo1(0)) & "' and dm_wz.mc = '" & Trim(Combo1(1)) & "'" 
            sQSql = sQSql & " union select  kucun.update_date,dm_ck.mc,dm_service.mc,kucun.s_w,kucun.sl,kucun.total_je from kucun inner join dm_service on kucun.wzdm = dm_service.dm inner join dm_ck on kucun.ckdm = dm_ck.dm where kucun.s_w = '1' and dm_ck.mc = '" & Trim(Combo1(0)) & "' and dm_service.mc = '" & Trim(Combo1(1)) & "'" 
        Else 
            'sQSql = "select  kucun.update_date,dm_ck.mc,dm_wz.mc,kucun.qihao,kucun.sl,kucun.total_je from kucun inner join dm_wz on kucun.wzdm = dm_wz.dm inner join dm_ck on kucun.ckdm = dm_ck.dm where dm_ck.mc = '" & Trim(Combo1(0)) & "'" 
             
            sQSql = "select  kucun.update_date,dm_ck.mc,dm_wz.mc,kucun.s_w,kucun.sl,kucun.total_je from kucun inner join dm_wz on kucun.wzdm = dm_wz.dm inner join dm_ck on kucun.ckdm = dm_ck.dm where kucun.s_w = '0' and dm_ck.mc = '" & Trim(Combo1(0)) & "'" 
            sQSql = sQSql & " union select  kucun.update_date,dm_ck.mc,dm_service.mc,kucun.s_w,kucun.sl,kucun.total_je from kucun inner join dm_service on kucun.wzdm = dm_service.dm inner join dm_ck on kucun.ckdm = dm_ck.dm where kucun.s_w = '1' and dm_ck.mc = '" & Trim(Combo1(0)) & "'" 
             
        End If 
    ElseIf chkItem(1).Value = vbChecked Then 
        'sQSql = "select  kucun.update_date,dm_ck.mc,dm_wz.mc,kucun.qihao,kucun.sl,kucun.total_je from kucun inner join dm_wz on kucun.wzdm = dm_wz.dm inner join dm_ck on kucun.ckdm = dm_ck.dm where dm_wz.mc = '" & Trim(Combo1(1)) & "'" 
         
         sQSql = "select  kucun.update_date,dm_ck.mc,dm_wz.mc,kucun.s_w,kucun.sl,kucun.total_je from kucun inner join dm_wz on kucun.wzdm = dm_wz.dm inner join dm_ck on kucun.ckdm = dm_ck.dm where kucun.s_w = '0' and  dm_wz.mc = '" & Trim(Combo1(1)) & "'" 
         sQSql = sQSql & " union select  kucun.update_date,dm_ck.mc,dm_service.mc,kucun.s_w,kucun.sl,kucun.total_je from kucun inner join dm_service on kucun.wzdm = dm_service.dm inner join dm_ck on kucun.ckdm = dm_ck.dm where kucun.s_w = '1' and  dm_service.mc = '" & Trim(Combo1(1)) & "'" 
         
    Else 
        sQSql = "" 
    End If 
     
    If Trim(sQSql) = "" Then 
        MsgBox "请设置查询条件!", vbOKOnly + vbExclamation, "警告" 
        Exit Sub 
    Else 
        frmInquireMINGXI.txtSQL = sQSql 
         
        Me.Hide 
        frmInquireMINGXI.Show 0 
    End If 
     
End Sub 
 
Private Sub Combo1_Click(Index As Integer) 
    Dim txtSQL As String 
    Dim mrc As ADODB.Recordset 
    Dim MsgText As String 
     
    If Index = 0 Then 
         
        Combo1(1).Enabled = True 
        Combo1(1).Clear 
         
        'txtSQL = "select distinct dm_wz.mc from kucun inner join dm_wz on kucun.wzdm = dm_wz.dm inner join dm_ck on kucun.ckdm = dm_ck.dm where dm_ck.mc = '" & Trim(Combo1(0)) & "'" 
        'Set mrc = ExecuteSQL(txtSQL, MsgText) 
         
        'If Not mrc.EOF Then 
        '    With mrc 
        '        Do While Not .EOF 
        '            Combo1(1).AddItem .Fields(0) 
        '            .MoveNext 
        '        Loop 
        '    End With 
             
        '    Combo1(1).ListIndex = 0 
        'Else 
        '    cmdOk.Enabled = False 
        'End If 
         
        'mrc.Close 
         
        txtSQL = "select distinct dm_wz.mc from kucun inner join dm_wz on kucun.wzdm = dm_wz.dm inner join dm_ck on kucun.ckdm = dm_ck.dm where kucun.s_w = '0' and dm_ck.mc = '" & Trim(Combo1(0)) & "'" 
        txtSQL = txtSQL & " Union select distinct dm_service.mc from kucun inner join dm_service on kucun.wzdm = dm_service.dm inner join dm_ck on kucun.ckdm = dm_ck.dm where kucun.s_w = '0' and dm_ck.mc = '" & Trim(Combo1(0)) & "'" 
        Set mrc = ExecuteSQL(txtSQL, MsgText) 
         
        If Not mrc.EOF Then 
            With mrc 
                Do While Not .EOF 
                    Combo1(1).AddItem .Fields(0) 
                    .MoveNext 
                Loop 
            End With 
             
            'Combo1(1).ListIndex = 0 
        Else 
            cmdOk.Enabled = False 
        End If 
         
        mrc.Close 
         
         
    End If 
     
End Sub 
 
Private Sub Form_Load() 
     
     
    Dim i As Integer 
    Dim j As Integer 
    Dim sSql As String 
    Dim txtSQL As String 
    Dim MsgText As String 
    Dim mrc As ADODB.Recordset 
     
    Combo1(0).Clear 
    Combo1(1).Clear 
     
    txtSQL = "select distinct dm_ck.mc from kucun inner join dm_ck on kucun.ckdm = dm_ck.dm" 
    Set mrc = ExecuteSQL(txtSQL, MsgText) 
     
    If Not mrc.EOF Then 
        With mrc 
            Do While Not .EOF 
                Combo1(0).AddItem .Fields(0) 
                .MoveNext 
            Loop 
        End With 
         
        Combo1(1).Enabled = False 
        'Combo1(0).ListIndex = 0 
    Else 
        Combo1(1).Enabled = False 
        cmdOk.Enabled = False 
    End If 
     
    mrc.Close 
     
    'txtSQL = "select distinct dm_wz.mc from kucun inner join dm_wz on kucun.wzdm = dm_wz.dm inner join dm_ck on kucun.ckdm = dm_ck.dm where dm_ck.mc = '" & Trim(Combo1(0)) & "'" 
     
     
    'txtSQL = "select distinct dm_wz.mc from kucun inner join dm_wz on kucun.wzdm = dm_wz.dm inner join dm_ck on kucun.ckdm = dm_ck.dm where kucun.s_w = '0' and dm_ck.mc = '" & Trim(Combo1(0)) & "'" 
    'txtSQL = txtSQL & " Union select distinct dm_service.mc from kucun inner join dm_service on kucun.wzdm = dm_service.dm inner join dm_ck on kucun.ckdm = dm_ck.dm where kucun.s_w = '1' and dm_ck = '" & Trim(Combo1(0)) & "'" 
     
     
     
   
End Sub