Private showModel As Boolean
Private showLaborItems As Boolean
Private showItemPrice As Boolean
Private showPageHeader As Boolean
Sub ReportHeader1_Format
ReportUtilities.SetPresentedToAddress(rpt,"ReportHeader1","txtProjectAddress")
ReportUtilities.SetPresentedByAddress(rpt,"ReportHeader1","txtCompanyAddress")
ReportUtilities.SetCompanyLogo(rpt,"picLogo")
' if we are hiding page headers, then set Visible = false on the
' following controls.
If Not showPageHeader Then
ReportUtilities.SetControlVisibility(rpt, "picRptHeader", false)
ReportUtilities.SetControlVisibility(rpt, "txtRptHeader", false)
ReportUtilities.SetControlVisibility(rpt, "lblModified", false)
ReportUtilities.SetControlVisibility(rpt, "lblRevision", false)
ReportUtilities.SetControlVisibility(rpt, "txtModifiedDate", false)
ReportUtilities.SetControlVisibility(rpt, "txtRevision", false)
End If
End Sub
Sub grpItemHeader_Format
' If we are showing the Model #, then set it, otherwise the control will use the default binding
If showModel Then
ReportUtilities.SetManufacturerModelTextBox(rpt,"grpItemHeader","txtModel")
End If
ReportUtilities.SetControlTopPosition(rpt, "grpItemHeader", "txtDescription", "txtModel", .02)
'ReportUtilities.SetControlTopPosition(rpt, "grpItemHeader", "subProposalItemsLevel2", "txtDescription", .02)
' if showing the item price, then determine whether the "*" is to be shown
' otherwise set visible to false.
If showItemPrice Then
' get the current item the report is on...
' determine if "*" label is being shown
Dim itm As DTools.SystemIntegrator.Reporting.Item = ReportUtilities.ReturnItem(rpt)
Dim accessorizedPrice As Boolean = itm.AccessorizedPrice ' false
ReportUtilities.SetControlVisibility(rpt, "lblAccessorized", accessorizedPrice)
Else
ReportUtilities.SetControlVisibility(rpt, "lblAccessorized", false)
End If
' control visibility of price field based on parameter
ReportUtilities.SetControlVisibility(rpt, "txtPrice", showItemPrice)
End Sub
Sub ActiveReport_ReportStart
'showDetail = False
' Apply Items Filter
ReportUtilities.ApplyDataSourceFilter(rpt,1)
' detemine whether labor items should be displayed in the report details
showLaborItems = true
Dim showLaborItemParam As object = ReportUtilities.ReturnParameterValue("ShowLaborItems")
If Not showLaborItemParam Is Nothing Then
If Not Boolean.TryParse(showLaborItemParam.ToString, showLaborItems) Then
showLaborItems = true
End If
End If
' if we're not showing labor items, apply the filter
If Not showLaborItems Then ReportUtilities.ApplyLaborItemFilter(rpt)
' show/hide page headers and footers
showPageHeader = true
Dim showHeaderParam As object = ReportUtilities.ReturnParameterValue("ShowPageHeader")
If Not showHeaderParam Is Nothing Then
If Not Boolean.TryParse(showHeaderParam.ToString, showPageHeader) Then
showPageHeader = true
End If
End If
'ReportUtilities.SetSectionVisibility(rpt, "PageHeader1", showPageHeader)
ReportUtilities.SetSectionVisibility(rpt, "PageFooter1", showPageHeader)
If Not showPageHeader Then
CType(rpt.Sections("grpHeadings"),DataDynamics.ActiveReports.GroupHeader).RepeatStyle = DataDynamics.ActiveReports.RepeatStyle.None
End If
'Determine if the report should show the Model ID
' get the parameter value
Dim showModelParam As object = ReportUtilities.ReturnParameterValue("ShowModel")
' set the default value
showModel = false
' if the parameter value is not null, then parse it
If Not showModelParam Is Nothing Then
If Not Boolean.TryParse(showModelParam.ToString, showModel) Then
showModel = false
End If
End If
' handle whether Detail is being shown or no
' See if parent report has the 'SummarizeAcc' parameter
Dim paramValue As Object = ReportUtilities.ReturnParameterValue("SummarizeAcc")
' if the parameter value exists, then process it, otherwise false
If Not (paramValue Is Nothing) Then
' if 'None' then show detail for all items
If paramValue.ToString = "None" Then
ReportUtilities.SummarizeEquipment = 0 '0 = ItemSummaryEnum.ShowAllDetail
' if use the item setting, then
ElseIf paramValue.ToString = "Item" Then
ReportUtilities.SummarizeEquipment = 1 '1 = ItemSummaryEnum.ItemSetting
Else
ReportUtilities.SummarizeEquipment = 2 '2 = ItemSummaryEnum.ShowNoDetail
End If
End If
' get the parameter
Dim summParam As object = ReportUtilities.ReturnParameterValue("SummarizePkg")
' if nothing, set it to an empty string
If Not (summParam Is Nothing) Then
If summParam.ToString = "None" Then
ReportUtilities.SummarizePackages = 0 '0 = ItemSummaryEnum.ShowAllDetail
ElseIf summParam.ToString = "Item" Then
ReportUtilities.SummarizePackages = 1 '1 = ItemSummaryEnum.ItemSetting
Else
ReportUtilities.SummarizePackages = 2 '2 = ItemSummaryEnum.ShowNoDetail
End If
End If
' show/hide line item price field
showItemPrice = true
Dim showItemPriceParam As object = ReportUtilities.ReturnParameterValue("ShowItemPrice")
If Not showItemPriceParam Is Nothing Then
If Not Boolean.TryParse(showItemPriceParam.ToString, showItemPrice) Then
showItemPrice = true
End If
End If
End Sub
Sub GrpDynamicHeader1_Format
ReportUtilities.SetDescriptionTextBox(rpt,"GrpDynamicHeader1","txtDynamicDesc1")
End Sub
Sub GrpDynamicHeader2_Format
ReportUtilities.SetDescriptionTextBox(rpt,"GrpDynamicHeader2","txtDynamicDesc2")
End Sub
Sub GrpDynamicHeader3_Format
ReportUtilities.SetDescriptionTextBox(rpt,"GrpDynamicHeader3","txtDynamicDesc3")
End Sub
Sub ActiveReport_DataInitialize
' add calculated field to the data source.
' this field will equal the integer equivalent of the Summarize Field so the group can keep track
rpt.CalculatedFields.Add("SummarizeInt")
End Sub
Function ActiveReport_FetchData(ByVal EOF As Boolean) As Boolean
Dim ds As DataDynamics.ActiveReports.Datasources.XMLDatasource = ctype(rpt.Datasource, DataDynamics.ActiveReports.Datasources.XMLDatasource)
If ds.EOF Then return True
' default the calculated to 0
rpt.CalculatedFields("SummarizeInt").Value = 0
'ReportUtilities.Spot("FetchData")
'ReportUtilities.SetCurrentProposalItem(rpt)
' get the current item the report is on...
Dim itm As DTools.SystemIntegrator.Reporting.Item = ReportUtilities.ReturnItem(rpt)
' If the item is not null, set value of the calculated field
If itm IsNot Nothing Then
rpt.CalculatedFields("SummarizeInt").Value = Ctype(itm.Summarize, Integer)
End If
'ReportUtilities.Spot("FetchData Detail:" & showDetail)
' Return whether this is the last record.
' This Is required Or the report will iterate forever over And never return
return (ds.NodeList.Count = ds.CurrentPosition)
End Function
Sub grpItemFooter_Format
Dim showDetail As Boolean
Dim itemSummary As Integer = 0
' Does the group have at least one item that is not set to summarize?
' The value of the txtItemSummary Textbox is the "Max" value of all items in group
' This textbox is bound to the calculatedField: SummarizeInt
' True Boolean values converted to Integer = -1, so if the Max value is 0 then at least one record in the
' group is flagged to NOT summarize
try
itemSummary = ctype(ReportUtilities.ReturnTextBoxValue(rpt,"grpItemFooter","txtItemSummary"),Integer)
catch
End Try
' Does this group represent a package???
' If so, the value of the txtPackage textbox will not be null or an empty string
Dim pkg As String = ""
Try
pkg = ctype(ReportUtilities.ReturnTextBoxValue(rpt,"grpItemFooter","txtPackage"),String)
Catch
End Try
' if item is a package, the package ID will have a value
If Not String.IsNullOrEmpty(pkg) Then
Select Case ReportUtilities.SummarizePackages
Case 0 ' ShowAllDetail
showDetail = True
Case 1 ' ItemSetting
' if the itemSummary <> 0 then
If itemSummary <> 0 Then
showDetail = False
Else
showDetail = True
End If
Case 2 ' ShowNoDetail
showDetail = False
End Select'
Else ' this is an equipment Item
Select Case ReportUtilities.SummarizeEquipment
Case 0 ' ShowAllDetail
showDetail = True
Case 1 ' ItemSetting
If itemSummary <> 0 Then
Else
showDetail = True
End If
Case 2 ' ShowNoDetail
showDetail = False
End Select
End If
If showDetail Then
Dim itemHash As Integer = 0
' set the current proposal item in the helper class to the item to the item that matches the groups
' itemHash value.
try
itemHash = ctype(ReportUtilities.ReturnTextBoxValue(rpt,"grpItemFooter","txtItemHash"),Integer)
ReportUtilities.SetCurrentProposalItem(itemHash)
catch
End try
' bind the sub report so it runs
ReportUtilities.BindSubReport(rpt, "grpItemFooter", "subProposalItemsLevel2")
Else
' unbind it to avoid processing time.
ReportUtilities.UnBindSubReport(rpt, "grpItemFooter", "subProposalItemsLevel2")
End If
showDetail = False
End Sub
Sub PageFooter1_Format
Dim dt As new Date
ReportUtilities.SetTextBoxValue(rpt, "PageFooter1","txtRunDate", dt.Today.ToString("d"))
End Sub
Sub grpMiscCosts_Format
If ReportUtilities.TotalMiscCosts(rpt) = 0 Then
ReportUtilities.UnbindSubReport(rpt,"grpMiscCosts","subMiscCosts")
ReportUtilities.SetSectionVisibility(rpt,"grpMiscCosts", false)
End If
End Sub
Sub PageHeader1_Format
If showPageHeader = false Then
ReportUtilities.SetControlVisibility(rpt, "txtPageHeader", false)
ReportUtilities.SetControlVisibility(rpt, "picPageHeader", false)
End If
'ReportUtilities.SetSectionVisibility(rpt, "PageHeader1", showPageHeader)
End Sub |