We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Very Custom Summary

Hi, I have a grouping grid which hold GL Accounts. The grouping is done on 3 groups, expenses, income, promotions. All amounts come from the database as positives (ABS), because on a summary row, it should display it''s sub-total. Is there a way to make the top level have a different formula than the other levels? I have modified the custom summary so that it picks up a multiplier fiels (1 or -1), to get it''s real value. Just to summarise: * the top level is sum of all accounts * their multiplier (distiguishes expense accounts from income accounts) * all other levels are to sum their child records as they are. Any ideas? Bellow i will post the changes i''ve made to the custom summary class provided in the samples.

2 Replies

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.

Live Chat Icon For mobile
Up arrow icon