Dear Sir
I'm Trying to Create Multi Grouping row and adding the total of each in report viewer RDLC in VB.NET.
Please Guide Me.
Thanks
Code in FORM1
Imports System.Data.OleDb
Imports Dapper
Public Class Form1
Private Function CreateConnection() As String
Return ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\GROUPROW.accdb;Persist Security Info=False;")
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Using db As IDbConnection = New OleDbConnection(CreateConnection)
If db.State = ConnectionState.Closed Then
db.Open()
End If
'Execute query to get orderdetails and products data
Dim query As String = "SELECT ITEM,PRICE,QTY,CATEGORY1,CATEGORY2 FROM ITEM"
Dim list As List(Of ITEM) = db.Query(Of ITEM)(query, commandType:=CommandType.Text).ToList()
Using frm As New frmPrintPreview(list)
frm.ShowDialog()
End Using
End Using
End Sub
End Class
Public Class ITEM
Public Property CATEGORY1() As String
Public Property CATEGORY2() As String
Public Property ITEM() As String
Public Property PRICE() As Integer
Public Property QTY() As Integer
End Class
code in frmPrintPreview
Imports Microsoft.Reporting.WinForms
Public Class frmPrintPreview
Private _list As List(Of ITEM)
Public Sub New(ByVal list As List(Of ITEM))
InitializeComponent()
_list = list
End Sub
Private Sub frmPrintPreview_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ITEMBindingSource.DataSource = _list
Me.ReportViewer1.RefreshReport()
Me.ReportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout)
ReportViewer1.ZoomMode = ZoomMode.Percent
ReportViewer1.ZoomPercent = 100
End Sub
End Class
Desired Result
CATEGORY1 CATEGORY2 ITEM PRICE QTY
A1 A1-1 1000 12000 10
A1-1 TOTAL 10
A1-2 1001 15000 8
A1-2 TOTAL 8
A1 TOTAL 18
B2 B2-1 1002 25000 20
B2-1 TOTAL 20
B2-2 1004 30000 25
1005 30000 30
B2-2 TOTAL 55
B2 TOTAL 75
TOTAL 93