如何在RDLC报告中计算借方,贷方,银行对账单等余额 [英] How to calculate debit, credit, balance like bank statement in RDLC report
本文介绍了如何在RDLC报告中计算借方,贷方,银行对账单等余额的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我的项目中间有结构,我需要银行对账单等借方贷方余额
看看喜欢这个
Hi
I have struct in middle of my project that I need Debit Credit balance like Bank statement
Look Like this
Date Debit Credit Balance
2018-01-01 3250.00 0.00 3250.00
2018-01-05 0.00 1000.00 2250.00
2018-01-12 0.00 250.00 2500.00
2018-01-22 500.00 0.00 2000.00
但是一旦使用了代码在下面。我喜欢这个
But Once used the code which is below. I got Like this
Date Debit Credit Balance
2018-01-01 3250.00 0.00 3250.00
2018-01-05 0.00 1000.00 -1000.00
2018-01-12 0.00 250.00 -250.00
2018-01-22 500.00 0.00 500.00
< br $> b $ b
请给我建议
Maideen
我尝试过什么:
Pls advice me
Maideen
What I have tried:
Private Sub PopulateTrans()
Me.ReportViewer1.LocalReport.DisplayName = "Statement"
ReportViewer1.ProcessingMode = ProcessingMode.Local
ReportViewer1.LocalReport.ReportPath = Server.MapPath("Bank_Statement.rdlc")
Dim dsReport As Report_DataSet = GetData()
Dim datasource As New ReportDataSource("DataSet1", dsReport.Tables(1))
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.DataSources.Add(datasource)
End Sub
Private Function GetData() As Report_DataSet
Dim finalbalance As Integer = 0
Dim conString As String = ConfigurationManager.ConnectionStrings("ConnectString").ConnectionString
Dim cmd As SqlCommand = New SqlCommand("SELECT docdate,acno,debit,credit,balance FROM tbl_Reports_all")
Using con As SqlConnection = New SqlConnection(conString)
Using sda As SqlDataAdapter = New SqlDataAdapter()
cmd.Connection = con
cmd.CommandType = CommandType.Text
sda.SelectCommand = cmd
Using trans As Report_DataSet = New Report_DataSet()
sda.Fill(trans, "Report_DataSet")
Dim dt As DataTable = trans.Tables("Report_DataSet")
For i As Integer = 0 To (dt.Rows).Count - 1
Dim credit As String = dt.Rows(i)("credit").ToString()
Dim debit As String = dt.Rows(i)("debit").ToString()
If credit <> "" AndAlso debit = "" Then
Dim balance As Integer = If(dt.Rows(i)("balance").ToString() = "", finalbalance, Convert.ToInt32(dt.Rows(i)("balance").ToString()))
Dim Testbalance As Integer = balance + Convert.ToInt32(dt.Rows(i)("credit").ToString())
finalbalance = Testbalance
dt.Rows(i)("balance") = finalbalance
ElseIf debit <> "" AndAlso credit = "" Then
Dim balance As Integer = If(dt.Rows(i)("balance").ToString() = "", finalbalance, Convert.ToInt32(dt.Rows(i)("balance").ToString()))
Dim Testbalance As Integer = balance - Convert.ToInt32(dt.Rows(i)("debit").ToString())
finalbalance = Testbalance
dt.Rows(i)("balance") = finalbalance
End If
Next
Return trans
End Using
End Using
End Using
End Function
推荐答案
没有意义读取余额。
维持运行总计并在阅读时更新每行的余额。 />
每行
:
加入总借记。
加入总计学分。
当前行的当前平衡是(总借方 - 总学分)直到那一点。
No point in "reading" the balance.
Maintain "running totals" and update the balance in each row as you read it.
for each row:
Add to total debits.
Add to total credits.
CURRENT BALANCE for the current row is simply (total debits - total credits) up to that point.
这篇关于如何在RDLC报告中计算借方,贷方,银行对账单等余额的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文