SSRS Code Doubling

I’m trying to use the VB.Net code for a total field.
In the report builder, it looks fine (should be 64k), but when I preview from Epicor, it doubles that number.
Why is that happening?

Here’s the code I have set up:

  Public Dim Shared invTotal as Decimal

  Public Function InitInvTotal() As String
     invTotal = 0
     Return ""
  End Function

  Public Function GetInvTotal() As Decimal
     Return invTotal
  End Function

  Public Function InvTotalCalc(ByVal kitPrice As String, ByVal kitPLine As Integer, ByVal oLine As Integer, ByVal extPrice As Decimal) As String
     Dim rtnVal = 0
     If kitPrice = "C" AND kitPLine <> oLine Then
        invTotal = invTotal + 0
        rtnVal = 0
     Else
        invTotal = invTotal + extPrice
        rtnVal = extPrice
     End If
     Return ""
  End Function

** Edit - Actually, every time I run it, it seems to add 64k to the total. I have the initialize function in the InvoiceNum group, so it should be resetting to zero every time a new invoice pops up.

Resetting the variable after the total was displayed seemed to clear this up.

Aaron,

I found a problem that every time I downloaded the report the query code in the dataset for some reason was duplicating itself. It happens in a lot of reports, so just as a sanity check I would recommend to check it. This right here