6.7日结设计
6.7.1客房销售报表
Private Sub Form_Load()
'自动识别数据库路径
Data1.DatabaseName = App.Path & "\KFGL.MDB"
Data2.DatabaseName = App.Path & "\KFGL.MDB"
czy.Text = main.StatusBar1.Panels(4).Text
DTP1.Value = Date - 1: DTP2.Value = Date
End Sub
Private Sub Form_Activate()
G1.Text = Left(DTP1, 4) & Right(Left(DTP1, 7), 2) & Right(DTP1, 2) & Left(DTM1, 2) & Left(Right(DTM1, 5), 2)
G2.Text = Left(DTP2, 4) & Right(Left(DTP2, 7), 2) & Right(DTP2, 2) & Left(DTM2, 2) & Left(Right(DTM2, 5), 2)
Data1.RecordSource = "select * from tfd where tfd.BZ >" & Val(G1.Text) & " AND tfd.BZ<" & Val(G2.Text) & " order by 凭证号码"
Data1.Refresh
'统计各项费用
Data2.RecordSource = "select count(*)as 数量1,sum(应收宿费)as 应收宿费1,sum(杂费)as 杂费1,sum(电话费)as 电话费1 ,sum(会议费)as 会议费1,sum(存车费)as 存车费1,sum(赔偿费)as 赔偿费1,sum(金额总计)as 总计金额1,sum(预收宿费)as 预收宿费1,sum(退还宿费)as 退还宿费1 from tfd where tfd.BZ >" & Val(G1.Text) & "AND tfd.bz<" & Val(G2.Text)
Data2.Refresh
'设置MSFlexgrid的列宽
MS1.ColWidth(0) = 0: MS1.ColWidth(1) = 1500: MS1.ColWidth(2) = 600
MS1.ColWidth(3) = 0: MS1.ColWidth(4) = 0: MS1.ColWidth(5) = 0
MS1.ColWidth(7) = 600: MS1.ColWidth(8) = 0: MS1.ColWidth(9) = 450
MS1.ColWidth(10) = 0: MS1.ColWidth(11) = 0: MS1.ColWidth(12) = 450
MS1.ColWidth(13) = 0: MS1.ColWidth(14) = 840: MS1.ColWidth(15) = 450
MS1.ColWidth(16) = 900: MS1.ColWidth(17) = 450: MS1.ColWidth(18) = 780
MS1.ColWidth(19) = 780: MS1.ColWidth(20) = 780: MS1.ColWidth(21) = 780
MS1.ColWidth(22) = 780: MS1.ColWidth(23) = 780: MS1.ColWidth(24) = 780
MS1.ColWidth(25) = 0: MS1.ColWidth(26) = 0: MS1.ColWidth(27) = 0
MS1.ColWidth(28) = 0: MS1.ColWidth(29) = 0: MS1.ColWidth(30) = 0
MS1.ColWidth(31) = 0: MS1.ColWidth(6) = 0
MS2.ColWidth(0) = 4950: MS2.ColWidth(1) = 900: MS2.ColWidth(2) = 450
MS2.ColWidth(3) = 780: MS2.ColWidth(4) = 780: MS2.ColWidth(5) = 780
youerw.com
main.Enabled = True
Unload Me
End Sub
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\KFGL.MDB" '自动识别数据库路径
End Sub
Private Sub Form_Activate()
Text1.SetFocus 'text1获得焦点
End Sub
Private Sub Form_Unload(Cancel As Integer)
main.Enabled = True
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text2.SetFocus '回车text2获得焦点
End Sub
Private Sub text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text3.SetFocus '回车text3获得焦点
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Command1.SetFocus '回车Command1获得焦点
End Sub
Private Sub Command1_Click()
'保存操作员及密码
If Text1.Text <> "" Then
If Text2.Text <> "" Then
Data1.Recordset.AddNew
Data1.Recordset.Fields("操作员") = Text1.Text
Data1.Recordset.Fields("密码") = Text2.Text
Data1.Recordset.Update '更新记录
Data1.Refresh