BH
Bernard Herrok
December 13, 2004 01:49 AM UTC
Public NotInheritable Class NetTotalSummary2
Inherits SummaryBase
Private _total As Double
Private mMultiplier As Integer
Private mLevel As Integer
Public Shared Empty As New NetTotalSummary2(0, -2, 0)
Public Shared Function CreateSummaryMethod(ByVal sd As SummaryDescriptor, ByVal record As Record) As ITreeTableSummary
Dim obj As Object = sd.GetValue(record)
Dim isNull As Boolean = obj Is Nothing OrElse TypeOf obj Is DBNull
If isNull Then
Return Empty
Else
Dim val As Double = Convert.ToDouble(obj)
Return New NetTotalSummary2(val, Integer.Parse(record.ParentTableDescriptor.Fields("Multiplier").GetValue(record)), record.GroupLevel)
End If
End Function ''CreateSummaryMethod
Public Sub New(ByVal total As Double, ByVal multiplier As Integer, ByVal level As Integer)
_total = total
mMultiplier = multiplier
mLevel = level
End Sub ''New
Public ReadOnly Property Total() As Double
Get
Return _total
End Get
End Property
Public ReadOnly Property Multiplier() As Integer
Get
Return mMultiplier
End Get
End Property
Public ReadOnly Property Level() As Integer
Get
Return mLevel
End Get
End Property
Public Overloads Overrides Function Combine(ByVal other As SummaryBase) As SummaryBase
Return Combine(CType(other, NetTotalSummary2))
End Function ''Combine
Public Overloads Function Combine(ByVal other As NetTotalSummary2) As NetTotalSummary2
If Me.Level = 3 Then
Return New NetTotalSummary2(((Me.Total * Me.Multiplier) + (other.Total * other.Multiplier)), Math.Max(Me.Multiplier, other.Multiplier), Me.Level)
Else
Return New NetTotalSummary2(Me.Total + other.Total, Math.Max(Me.Multiplier, other.Multiplier), Me.Level)
End If
End Function ''Combine
Public Overrides Function ToString() As String
Return String.Format("Total = {0:0.00}", 10) '' Total)
End Function ''ToString
End Class ''NetTotalSummary
AD
Administrator
Syncfusion Team
December 16, 2004 01:30 PM UTC
Here is a sample that adds a summary row that displays a summary column value which is computed from the values of two summary columns in the summary row. In this sample, a weighted sum of one column is computed using weights from another. To compute the weighted sum, requires dividing one summary result by another.
http://64.78.18.34/Support/user/uploads/GCCSummary_CombineColResults.zip