我正在做的是创建一个 PDF 文件并返回本周的预订。周一、周四、周三等都有预订。我尝试将预订分配给他的日期。我的意思是。如果有星期一的预订,则应将预订分配到该日期。如果预订在星期二,则将星期四的预订分配给该日期。
为了说明这一点: WeeklyBPlan
正如您在 Montag(星期一)的图片预订和 Dienstag(星期二)的预订中看到的那样。
我的问题是,使用我的代码只返回一周的第一天(星期一),并且所有预订都分配给该日期。
我认为我的问题是wbp.WeekDay = strCurrDay
或我的 .fo 有问题?
请问有人可以帮我吗?我怎样才能做我想做的事,比如图片中的?
Public Shared Function WeeklyBPlanPDFExport() As List(Of WeeklyBPlan)
Dim allBookings As List(Of WeeklyBPlan) = New List(Of WeeklyBPlan)
Dim s As StringBuilder = New StringBuilder
Dim kw As Integer = DatePart(DateInterval.WeekOfYear, Now, , FirstWeekOfYear.FirstFourDays)
If DatePart(DateInterval.Weekday, Now, Microsoft.VisualBasic.FirstDayOfWeek.Sunday) = 6 Then
kw = kw + 1
End If
Dim CurrDateFirstDay As Date = DateAdd(DateInterval.Day, 1, ReturnDateForWeekNumber(kw))
For i = 1 To 7
Dim strCurrDay As String = ""
strCurrDay = FormatDateTime(CurrDateFirstDay, DateFormat.LongDate)
CurrDateFirstDay = DateAdd(DateInterval.Day, 1, CurrDateFirstDay)
Dim strSQL As String = "SELECT d.SEATING, d.ROOMID, d.ID, d.PERSONS, d.ADDRESS+ ', ' + d.ROOMDESCRIPTION AS ROOMDESCRIPTION , d.EVENT, p.VN + ' ' + p.NN AS NAME, CONVERT (char(5), d.FROM, 108) + ' - ' + CONVERT (char(5), d.TO, 108) AS TIME, p.TEL FROM VIEW_RAUMBUCHUNG_DISPO AS d INNER JOIN PERSONAL AS p ON d.PERSONAL_ID = p.ID WHERE CONVERT(char, d.FROM, 104)='" & to_104(strCurrDay) & "'"
Dim objRS As SqlDataReader
Dim objRS2 As SqlDataReader
objRS = SQLrunReaderWB(strSQL)
If objRS.HasRows Then
While objRS.Read()
Dim wbp = New WeeklyBPlan
wbp.WeekDay = strCurrDay
wbp.Raum = objRS("ROOMDESCRIPTION")
wbp.Zeit = objRS("TIME")
If Not IsDBNull(objRS("EVENT")) Then
wbp.Thema = objRS("EVENT")
End If
If Not IsDBNull(objRS("NAME")) Then
wbp.Mieter = objRS("NAME")
End If
wbp.Personen = objRS("PERSONS")
wbp.Bestuhlung = objRS("SEATING")
allBookings.Add(wbp)
End While
End If
Next
ConnWB.Close()
Return allBookings
End Function
我的 XSL-FO:
`
<!--this defines a title level 1 -->
<fo:block
line-height="24pt"
space-after.optimum="15pt"
padding-top="3pt">
<xsl:value-of select=".//WeekDay" />
</fo:block>
<!-- table start -->
<fo:table table-layout="fixed" border="solid" border-collapse="collapse" border-width="0.5pt">
<fo:table-column column-width="25mm"/>
<fo:table-column column-width="12mm"/>
<fo:table-column column-width="20mm"/>
<fo:table-column column-width="50mm"/>
<fo:table-column column-width="20mm"/>
<fo:table-column column-width="25mm"/>
<fo:table-column column-width="10mm"/>
<fo:table-column column-width="30mm"/>
<fo:table-column column-width="35mm"/>
<fo:table-column column-width="35mm"/>
<fo:table-header>
<fo:table-row>
<fo:table-cell>
<fo:block background-color="grey"
color="white" text-align="center">Room</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block background-color="grey"
color="white" text-align="center">Time</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block background-color="grey"
color="white" text-align="center">Event</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block background-color="grey"
color="white" text-align="center">Persons</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block background-color="grey"
color="white" text-align="center">Seating</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<xsl:for-each select=".//WochenBPlan">
<fo:table-row>
<fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid" padding-right="6pt" padding-left="6pt" >
<fo:block font-family="Arial" font-size="9pt" padding="2pt">
<xsl:value-of select=".//Room" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid">
<fo:block font-family="Arial" font-size="9pt" padding="2pt" text-align="center">
<xsl:value-of select=".//Time" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid" padding-left="6pt" padding-right="6pt">
<fo:block font-family="Arial" font-size="9pt" padding="2pt" wrap-option="no-wrap" >
<xsl:value-of select=".//Event" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid">
<fo:block font-family="Arial" font-size="9pt" padding="2pt" text-align="center">
<xsl:value-of select=".//Persons" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid">
<fo:block font-family="Arial" font-size="9pt" padding="2pt" text-align="center">
<xsl:value-of select=".//Seating" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
<!-- table end -->
<fo:block id="lastBlock"/>
</fo:flow>`
WeeklylyBPlan 课程:
public class WochenBPlan
{
public WochenBPlan()
{
}
public string Raum { get; set; }
public DateTime Erstellt { get { return DateTime.Now; } set { } }
public string Zeit { get; set; }
public string Bereich { get; set; }
public string Thema { get; set; }
public string Mieter { get; set; }
public string Mieter_Tel { get; set; }
public string Personen { get; set; }
public string Bestuhlung { get; set; }
public string Bemerkung { get; set; }
public string Ausstattung { get; set; }
public string WochenTag { get; set; }
}