⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frminquireywy2.frm

📁 经典delphi,Delphi下深入Windows核心编程.原书光盘代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmInquireYWY2 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "进货信息查询——按业务员"
   ClientHeight    =   2580
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5610
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2580
   ScaleWidth      =   5610
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  '所有者中心
   Begin VB.CheckBox chkDate 
      Caption         =   "按时间:"
      Height          =   252
      Left            =   360
      TabIndex        =   19
      Top             =   720
      Width           =   852
   End
   Begin VB.ComboBox Combo1 
      Height          =   288
      Index           =   0
      Left            =   1440
      Style           =   2  'Dropdown List
      TabIndex        =   10
      Top             =   120
      Width           =   3852
   End
   Begin VB.Frame Frame1 
      Height          =   1212
      Index           =   0
      Left            =   1320
      TabIndex        =   4
      Top             =   600
      Width           =   3972
      Begin VB.ComboBox cboDay 
         Height          =   288
         Index           =   1
         Left            =   3048
         Style           =   2  'Dropdown List
         TabIndex        =   15
         Top             =   720
         Width           =   612
      End
      Begin VB.ComboBox cboMonth 
         Height          =   288
         Index           =   1
         Left            =   2136
         Style           =   2  'Dropdown List
         TabIndex        =   14
         Top             =   720
         Width           =   645
      End
      Begin VB.ComboBox cboYear 
         Height          =   288
         Index           =   1
         Left            =   960
         Style           =   2  'Dropdown List
         TabIndex        =   13
         Top             =   720
         Width           =   765
      End
      Begin VB.ComboBox cboDay 
         Height          =   288
         Index           =   0
         Left            =   3000
         Style           =   2  'Dropdown List
         TabIndex        =   8
         Top             =   240
         Width           =   612
      End
      Begin VB.ComboBox cboMonth 
         Height          =   288
         Index           =   0
         Left            =   2088
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   240
         Width           =   645
      End
      Begin VB.ComboBox cboYear 
         Height          =   288
         Index           =   0
         Left            =   912
         Style           =   2  'Dropdown List
         TabIndex        =   0
         Top             =   240
         Width           =   765
      End
      Begin VB.Label Label1 
         Caption         =   "日"
         Height          =   216
         Index           =   0
         Left            =   3720
         TabIndex        =   18
         Top             =   720
         Width           =   240
      End
      Begin VB.Label Label1 
         Caption         =   "年"
         Height          =   216
         Index           =   3
         Left            =   1800
         TabIndex        =   17
         Top             =   720
         Width           =   240
      End
      Begin VB.Label Label1 
         Caption         =   "月"
         Height          =   216
         Index           =   4
         Left            =   2808
         TabIndex        =   16
         Top             =   720
         Width           =   240
      End
      Begin VB.Label lblitem 
         Caption         =   "终止时间:"
         Height          =   252
         Index           =   3
         Left            =   240
         TabIndex        =   12
         Top             =   720
         Width           =   1092
      End
      Begin VB.Label lblitem 
         Caption         =   "起始时间:"
         Height          =   252
         Index           =   1
         Left            =   240
         TabIndex        =   11
         Top             =   240
         Width           =   1092
      End
      Begin VB.Label Label1 
         Caption         =   "日"
         Height          =   216
         Index           =   7
         Left            =   3720
         TabIndex        =   7
         Top             =   240
         Width           =   240
      End
      Begin VB.Label Label1 
         Caption         =   "年"
         Height          =   216
         Index           =   1
         Left            =   1752
         TabIndex        =   6
         Top             =   240
         Width           =   240
      End
      Begin VB.Label Label1 
         Caption         =   "月"
         Height          =   216
         Index           =   2
         Left            =   2760
         TabIndex        =   5
         Top             =   240
         Width           =   240
      End
   End
   Begin VB.CommandButton cmdOk 
      Caption         =   "确定 (&O)"
      Default         =   -1  'True
      Height          =   375
      Left            =   1680
      TabIndex        =   2
      Top             =   2040
      Width           =   1215
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "取消 (&X)"
      Height          =   375
      Left            =   3120
      TabIndex        =   3
      Top             =   2040
      Width           =   1215
   End
   Begin VB.Label lblitem 
      Caption         =   "业务员姓名:"
      Height          =   252
      Index           =   2
      Left            =   360
      TabIndex        =   9
      Top             =   120
      Width           =   972
   End
End
Attribute VB_Name = "frmInquireYWY2"
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 = 2 Then
        cboYear(0).SetFocus
    Else
        txtItem(Index).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
    
    sQSql = "select inh.in_date,dm_ywy.mc,inh.inh_no,dm_gf.dm,dm_gf.mc,dm_ck.dm,dm_ck.mc,dm_wz.dm,dm_wz.mc,inh.sl,inh.in_danj,inh.i_zk,inh.i_zke,inh.jsfk,inh.jz,inh.yf,inh.bz from inh inner join dm_ywy on inh.ywman = dm_ywy.dm inner join dm_gf on inh.gfdm = dm_gf.dm inner join dm_ck on inh.ckdm = dm_ck.dm inner join dm_wz on inh.wzdm = dm_wz.dm where inh.ywman = '" & Trim(Combo1(0).ItemData(Combo1(0).ListIndex)) & "'"

    If chkDate.Value = vbChecked Then
        dBeginDate = Format(CDate(cboYear(0) & "-" & cboMonth(0) & "-" & cboDay(0)), "yyyy-mm-dd")
        dEndDate = Format(CDate(cboYear(1) & "-" & cboMonth(1) & "-" & cboDay(1)), "yyyy-mm-dd")
        
        sQSql = sQSql & " and inh.in_date >= '" & dBeginDate & " '"
        sQSql = sQSql & " and inh.in_date <= '" & dEndDate & " '"
    End If
    
    If Trim(sQSql) = "" Then
        MsgBox "请设置查询条件!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
    Else
        frmInquireYWY.txtSQL = sQSql
        
        Me.Hide
        frmInquireYWY.Show 0
    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
    
    txtSQL = "select  dm_ywy.dm,dm_ywy.mc from inh inner join dm_ywy on inh.ywman = dm_ywy.dm "
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    MsgBox MsgText
    
    If Not mrc.EOF Then
        With mrc
            Do While Not .EOF
                Combo1(0).AddItem .Fields(1)
                Combo1(0).ItemData(Combo1(0).NewIndex) = .Fields(0)
                .MoveNext
            Loop
        End With
        
        Combo1(0).ListIndex = 0
    Else
        cmdOk.Enabled = False
    End If
    
    mrc.Close
    
  
    txtSQL = "select distinct datepart(yy,in_date) from inh"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    If mrc.EOF = False Then
        With mrc
            Do While Not .EOF
                cboYear(0).AddItem .Fields(0)
                cboYear(1).AddItem .Fields(0)
                .MoveNext
            Loop
        End With
        
        cboYear(0).ListIndex = 0
        cboYear(1).ListIndex = 0
        
        For j = 1 To 12
            cboMonth(0).AddItem j
            cboMonth(1).AddItem j
        Next j
        cboMonth(0).Text = Month(Now())
        cboMonth(1).Text = Month(Now())
        
        For j = 1 To 31
            cboDay(0).AddItem j
            cboDay(1).AddItem j
        Next j
        cboDay(0).Text = Day(Now())
        cboDay(1).Text = Day(Now())
    Else
        cmdOk.Enabled = False
    End If
    mrc.Close
End Sub


Private Sub txtItem_GotFocus(Index As Integer)
   
    txtItem(Index).SelStart = 0
    txtItem(Index).SelLength = Len(txtItem(Index))
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -