Please follow these steps –
1. Create a Custom report based on existing “Proposal(Install price)” report and name it as “Proposal (Install Price + Sales Tax)”.
2. Go to script tab - in the procedure “ActiveReport_DataInitialize” add the below line.
rpt.CalculatedFields.Add("ItemwithTax")
3. After adding the above line replace the full code within the function “Function ActiveReport_FetchData(ByVal EOF As Boolean) As Boolean” with the below lines
|
Code:
|
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)
Dim totalItemAmount As Double = 0
' 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)
Dim i As Integer
'assign the installation price
totalItemAmount = itm.InstallationPrice
For i =0 to itm.ItemTaxes.Count - 1
'Add the item tax amount
totalItemAmount += itm.ItemTaxes(i).Amount
Next i
End If
'Assign the item price with sales tax amount
rpt.CalculatedFields("ItemwithTax").Value = totalItemAmount
'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 |
4. Go to designer tab , change the DataField property value of “txtPrice”, “txtGrp3Price”,” txtGrp2Price”, “txtGrp1Price” and “txtSubTotal” textbox control to
ItemwithTax as illustrated in figure.
Data Field Property.JPG
5. Set MultLine property to False for “txtPrice” control.
6. Publish the report.
Now the new custom report is ready to run.
Hope it helps.