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

📄 form3.frm

📁 该程序采VB6作为前端开发工具,以SQL Server 2000作为后台数据库开发平台.
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form form3 
   Caption         =   "综合统计"
   ClientHeight    =   6345
   ClientLeft      =   165
   ClientTop       =   450
   ClientWidth     =   8160
   Icon            =   "Form3.frx":0000
   LinkTopic       =   "Form3"
   ScaleHeight     =   6345
   ScaleWidth      =   8160
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame3 
      Caption         =   "统计时间"
      Height          =   1455
      Left            =   120
      TabIndex        =   5
      Top             =   120
      Width           =   7935
      Begin VB.CommandButton Command1 
         Caption         =   "日统计费用"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   6120
         TabIndex        =   16
         Top             =   240
         Width           =   1335
      End
      Begin VB.CommandButton Command4 
         Caption         =   "费用统计"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   6120
         TabIndex        =   15
         Top             =   840
         Width           =   1335
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   3960
         TabIndex        =   13
         Top             =   600
         Width           =   1455
      End
      Begin MSComCtl2.DTPicker DTPicker3 
         Height          =   375
         Left            =   1320
         TabIndex        =   9
         Top             =   360
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   661
         _Version        =   393216
         Format          =   24576001
         CurrentDate     =   37272
      End
      Begin MSComCtl2.DTPicker DTPicker2 
         Height          =   375
         Left            =   1320
         TabIndex        =   10
         Top             =   960
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   661
         _Version        =   393216
         Format          =   24576001
         CurrentDate     =   37272
      End
      Begin VB.Label Label3 
         Caption         =   "收入情况:"
         Height          =   255
         Left            =   3000
         TabIndex        =   14
         Top             =   720
         Width           =   975
      End
      Begin VB.Label Label4 
         Caption         =   "from:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   15
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   -1  'True
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000C0&
         Height          =   375
         Left            =   360
         TabIndex        =   12
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label5 
         Caption         =   "to:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   15
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   -1  'True
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   495
         Left            =   600
         TabIndex        =   11
         Top             =   840
         Width           =   615
      End
   End
   Begin VB.Frame Frame2 
      Height          =   1095
      Left            =   2520
      TabIndex        =   4
      Top             =   1680
      Width           =   5535
      Begin VB.CommandButton Command5 
         Caption         =   "返回"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   4080
         Style           =   1  'Graphical
         TabIndex        =   8
         Top             =   360
         Width           =   1215
      End
      Begin VB.CommandButton Command2 
         Caption         =   "删除3年前的数据"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   1920
         TabIndex        =   7
         Top             =   360
         Width           =   1335
      End
      Begin VB.CommandButton Command3 
         Caption         =   "按省份统计"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   240
         TabIndex        =   6
         Top             =   360
         Width           =   1335
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "男女统计"
      Height          =   1095
      Left            =   120
      TabIndex        =   1
      Top             =   1680
      Width           =   2295
      Begin VB.OptionButton Option2 
         Caption         =   "女"
         Height          =   255
         Left            =   1320
         TabIndex        =   3
         Top             =   480
         Width           =   495
      End
      Begin VB.OptionButton Option1 
         Caption         =   "男"
         Height          =   255
         Left            =   360
         TabIndex        =   2
         Top             =   480
         Width           =   495
      End
   End
   Begin MSDataGridLib.DataGrid DataGrid1 
      Bindings        =   "Form3.frx":030A
      Height          =   3375
      Left            =   120
      TabIndex        =   0
      Top             =   2880
      Width           =   7935
      _ExtentX        =   13996
      _ExtentY        =   5953
      _Version        =   393216
      HeadLines       =   1
      RowHeight       =   15
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public rs As ADODB.Recordset
Public db As ADODB.Connection
Private Sub Command1_Click()
On Error Resume Next

Dim m As String
rs.Close
rs.Open "select sum(总金额) AS Expr1 from 退房情况  where 住店时间='" & DTPicker1.Value & "'"
Text1.Text = rs.Fields("Expr1").Value
 'End If
rs.Close
rs.Open "select * from 退房情况  where 住店时间='" & DTPicker1.Value & "'"
 Set DataGrid1.DataSource = rs

End Sub
Private Sub Command2_Click()
rs.Close
  rs.Open "select  min(住店时间) as Expr1 from 退房情况"
  
  w = rs.Fields("expr1").Value
  'MsgBox w
  'rs.Close
 'rs.Open "select * from 酒店登记 where 住店时间='" & Trim(w) & "'"
rs.Close
rs.Open "delete from 退房情况 where 住店时间='" & Trim(w) & "'"
Set DataGrid1.DataSource = rs
Command2.Enabled = False
   
     'Command1.Enabled = True
End Sub

Private Sub Command3_Click()
Dim strname As String * 40, strs1 As String * 40
strs1 = "请输入要查询的省份" + Chr(13) + Chr(10) + "然后单击确定"
 strname = InputBox$(strs1, "输入框", , 100, 100)

rs.Close
rs.Open " select 住店时间,姓名,性别,住宿天数,住宿人数,籍贯,证件名称,证件号码,房间类型,总床位数,房间号码,床位,出生日期,地址 from 酒店登记 where 籍贯='" & Trim(strname) & "'"
 Set DataGrid1.DataSource = rs
If rs.EOF Then
'Else
MsgBox "无此人!", , "提示"

   End If
End Sub

Private Sub Command4_Click()
On Error Resume Next

Dim m As String
rs.Close
rs.Open "select sum(总金额) AS Expr1 from 退房情况  where 住店时间 between '" & DTPicker3.Value & "' and '" & DTPicker2.Value & "'"

Text1.Text = rs.Fields("Expr1").Value
 'End If
rs.Close
rs.Open "select * from 退房情况  where 住店时间 between '" & DTPicker3.Value & "' and '" & DTPicker2.Value & "'"
 Set DataGrid1.DataSource = rs
End Sub

Private Sub Command5_Click()
Unload form3
End Sub

Private Sub Form_Load()
Set db = New ADODB.Connection
 Set rs = New ADODB.Recordset
 db.ConnectionString = "driver={SQL Server};server=04;database=酒店管理;Persist Security Info=False;User ID=sa"

db.Open
rs.Open "select * from 退房情况", db, adOpenStatic, adLockReadOnly
 Set DataGrid1.DataSource = rs
 Command2.Enabled = False
 rs.Close
rs.Open "select min(住店时间) as x from 退房情况 "
m = rs.Fields("x").Value
rs.Close
rs.Open "select max(住店时间) as y from 退房情况"
n = rs.Fields("y").Value

If DateDiff("yyyy", m, n) >= 3 Then
  n = MsgBox("旅客登记表里已经有三年时间以上的登记!请删除!", vbExclamation)
     Command2.Enabled = True
 End If
  rs.Close
  rs.Open "select  min(住店时间) as Expr1 from 退房情况"
  
  w = rs.Fields("expr1").Value
  'MsgBox w
  rs.Close
 rs.Open "select * from 退房情况 where 住店时间='" & Trim(w) & "'"
 Set DataGrid1.DataSource = rs
End Sub
Private Sub Option1_Click()
rs.Close
rs.Open "select * from 酒店登记 where 性别='男' order by 住店时间 desc"
Set DataGrid1.DataSource = rs
End Sub

Private Sub Option2_Click()
rs.Close
rs.Open "select * from 酒店登记 where 性别='女'order by 住店时间 desc"

Set DataGrid1.DataSource = rs
End Sub

⌨️ 快捷键说明

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