Dim Filter As String
With e.Form.Controls("DateTimePicker1")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "签约日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("DateTimePicker2")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "签约日期 <= #" & .Value & "#"
End If
End With
Dim xmtj As String '项目条件
Dim tj As String
If Filter > "" Then
xmtj = "<项目代码 = '" & (xmflt) & "'& "And" Filter>"
tj = "<项目代码 = '" & (xmflt) & "' and " & "子项目代码 = '" & (zxmflt) & "'
& "And" Filter>"
End If
Dim tjzq As String '统计周期
Dim ts As TimeSpan = Cdate(jsrq) - cdate(qsrq) '天数 DateDiff(interval,date1,date2)
If val(ts) <= 30 Then
tjzq = DateDiff(yyyy,qsrq,jsrq) & DateDiff(m,qsrq,jsrq) 'Cstr(Format(#qsrq#, "y"))
Else
If ts >= 30 And ts <= 90 Then
tjzq = DateDiff(yyyy,qsrq,jsrq) & DateDiff(q,qsrq,jsrq) 'Cstr(#qsrq#.year) & "季度"
Else
tjzq = DateDiff(yyyy,qsrq,jsrq) 'Cstr(#qsrq#.year)
End If
End If
Dim Sheet As XLS.Sheet = Book.Sheets(0)
If zxm = "" Then
Book.Marks("项目名称") = ("项目名称:") & (xm)
Book.Marks("建筑面积") = CDbl(zjmflt)
Book.marks("统计周期") = tjzq
Sheet(5,8).Value = xmtj
Else
Book.Marks("项目名称") = ("项目名称:") & (xm) & "(" & (zxm) & ")"
Book.Marks("建筑面积") = CDbl(jmflt)
Book.marks("统计周期") = tjzq
Sheet(5,8).Value = tj
End If