Reputation: 179
I am creating one Invoice Report .rdlc using visual basic what I am trying to do is group wise calculation like Please guide me with this
Example:
Tried adding datasource for VAT calculation but for amount column I am not getting any results in rdlc as for vat I am getting values in my rdlc
Dim connstring0 As String = String.Format("Server=127.0.0.1;Port=5432;Username=postgres;Password=Maestro;Database=IMS_DB;")
Dim conn0 As NpgsqlConnection = New NpgsqlConnection(connstring0)
conn0.Open()
Dim Command0 As NpgsqlCommand = New NpgsqlCommand("SELECT DISTINCT total_vat_onsales,SUM(amount) From invoice_withvat_table Where invoice_number = 'I20160711165711' GROUP BY total_vat_onsales", conn0) '(Select MAX(CAST(id AS bigint)) from invoice_withvat_table)
'MessageBox.Show("SELECT DISTINCT total_vat_onsales,SUM(CAST(amount As numeric(18,2))) From invoice_withvat_table Where invoice_number = '" + vb_inviceno + "' GROUP BY total_vat_onsales")
Dim reader0 As NpgsqlDataReader = Command0.ExecuteReader()
Dim data_Table10 As New DataTable
data_Table10.Load(reader0)
reader0.Close()
conn0.Close()
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.DisplayName = "Invoice With VAT"
ReportViewer1.LocalReport.ReportPath = "Invoice_WithVAT.rdlc"
Dim rds As ReportDataSource
rds = New ReportDataSource("DataSet1", data_Table1)
Dim rds0 As ReportDataSource
rds0 = New ReportDataSource("DataSet2", data_Table10)
ReportViewer1.LocalReport.DataSources.Add(rds)
ReportViewer1.LocalReport.DataSources.Add(rds0)
Me.ReportViewer1.RefreshReport()
It gets in rdlc but what to do next o achieve further
Upvotes: 1
Views: 990
Reputation: 6498
You must have to play with ReportItems.
As per your Image, you should do something like below.
1 - =SUM(Fields!Amount.Value)
2 - =(SUM(Fields!Amount.Value)/10)
3 - =SUM(Fields!Amount.Value)
Here, Sum.Value and Div.Value are Values from 1 output and 2 output. Same way you can do further calculations.
Upvotes: 1