'设置表样式
DataTables("选房窗口_Table1").AddUserStyle("a", Color.Red, Color.White) '定金的房态表样式
DataTables("选房窗口_Table1").AddUserStyle("b", Color.DarkGreen, Color.White) '确认的房态表样式
DataTables("选房窗口_Table1").AddUserStyle("c", Color.blue, Color.White) '可靠的房态表样式
DataTables("选房窗口_Table1").AddUserStyle("d", Color.FromARGB(255,255,128,0), Color.White) '入住的房态表样式
Dim mon As Integer = Tables("userb").current("zcldidariqi").Month
Dim days As Integer = Date.DaysInMonth(Tables("userb").current("zcldidariqi").Year,Tables("userb").current("zcldidariqi").Month)
Dim s As String
If Tables("userb").current("zcldidariqi").adddays(3).day < Tables("userb").current("zcldidariqi").day Then '如果跨月
For j As Integer = Tables("userb").current("zcldidariqi").adddays(-13).day To days
s + = "' ' As " & mon & "月" & j & "日,"
Next
Else '正常一个月
For j As Integer = Tables("userb").current("zcldidariqi").adddays(-1).day To Tables("userb").current("zcldidariqi").adddays(3).day
s + = "' ' As " & mon & "月" & j & "日,"
Next
End If
s = "Select 房型, ' ' As 房间号 , " & s.trim(",") & " from {客房信息表} order by 排序 " ' where 房型='标准间' " & s.trim(",") & "
Dim dt As DataTable = DataTables("选房窗口_table1")
dt.Fill( s , True)
Tables("选房窗口_table1").Cols("房间号").Width = 55
Tables("选房窗口_table1").Cols("房型").Width = 55
If dt.DataRows.Count < DataTables("客房信息表").datarows.Count Then
dt.AddNew(DataTables("客房信息表").datarows.Count - dt.DataRows.Count) 'Select("[房型]='标准间'").
End If
For i As Integer = 0 To DataTables("客房信息表").DataRows.Count - 1
For j As Integer = 0 To dt.DataRows.Count - 1
If i = j Then
dt.DataRows(j)("房间号") = DataTables("客房信息表").DataRows(i)("房间号")
End If
Next
Next
For Each ftdr As DataRow In dt.DataRows
For Each ftdc As DataCol In dt.DataCols
' For Each xcdr As DataRow In DataTables("zclxingcheng").DataRows
For Each xcdr As DataRow In DataTables("zclxingcheng").Select(" [日期] >= # " & Tables("userb").current("zcldidariqi").adddays(-1) & " # And [日期] <= # " & Tables("userb").current("zcldidariqi").adddays(3) & " # " )
If xcdr("日期").Year = Date.Today.Year AndAlso xcdr("日期").Month & "月" & xcdr("日期").Day & "日" = ftdc.Name AndAlso xcdr("房间号").Contains(ftdr("房间号")) Then
Dim dr As DataRow = DataTables("userb").Find("ID = '" & xcdr("客户ID") & "'")
If dr IsNot Nothing
ftdr(ftdc.Name) + = dr("name") & ","
End If
End If
Next
ftdr(ftdc.Name) = ftdr(ftdc.Name).Trim(",")
Next
Next
e.Form.Text = Date.Today.Year & "年" & Date.Today.Month & "月房态表"
'以下是把原有的房间号的行的复选框勾选上.
Dim zcl As String= Tables("userb.zclxingcheng").current("房间号")
Dim zcls As String =zcl.Replace(" ","")
For Each r As Row In Tables("选房窗口_table1").Rows
If zcls.Contains(r("房间号")) Then
r.Checked = True
End If
Next
---------------------------------------
有关以上代码的问题如下:
问题1: 红色部分代码, ' ' As 房间号 , " & s.trim(",") & " 这是什么意思?
问题2: 如果我想筛选出房型是标准间的怎么改代码, 我改成: s = "Select 房型, ' ' As 房间号 , " & s.trim(",") & " from {客房信息表} where 房型='标准间' order by 排序 " ,但列出的表格里是只列出了标准间, 但却列出了全部的房间号(包括其他房型的).
问题3: 全部房型都显示的房态表,有几十行,屏幕显示不下,需要下拉滚动查看,很不方便. 如何控制分段显示, 比如标准间显示在左边, 多人间显示在中间, 床位显示在右侧.
此主题相关图片如下:343444.jpg