strdate是日期
Dim dt As New DataTable Dim q1,q2 As String q1 =“SELECT SUM(当AdjustFlag ='D'时为CASE,然后0-Amount,其他数量为End)为total,rp.TransactionCode,rp.ReferenceDate,rp.TransactionFlag,rp.EncashDate”& _ “FROM dbo.ReceiptsPayments rp,dbo.ReceiptsPaymentsDetail rd”& _ “WHERE rp.TransactionCode = rd.TransactionCode AND(rp.EncashDate为NULL或rp.EncashDate> strDate)AND TransactionFlag ='P'Group(BY)rp.TransactionCode,rp.ReferenceDate,rp.TransactionFlag,rp.EncashDate”
q2 = "SELECT SUM(CASE when AdjustmentFlag='D' then 0-Amount else Amount end)as total " & _
"FROM ReceiptsPayments rp, ReceiptsPaymentsDetail rd " & _
"WHERE rp.TransactionCode = rd.TransactionCode and ReferenceDate <= strDate" & _
"AND TransactionFlag = 'P'"
dt.Columns.Add("ReconciliationDate", System.Type.GetType("System.DateTime"), "")
dt.Columns.Add("CashbookBalance", System.Type.GetType("System.Decimal"), "")
dt.Columns.Add("ChequesdrawnnotCleared", System.Type.GetType("System.Int32"), "")
dt.Columns.Add("ChequesreceivedNotCleared", System.Type.GetType("System.Int32"), "")
Dim dr(3) As Object
dr(0) = strDate 'ReconciliationDate
dr(1) = GET_DATAVALUE(q2, conn) 'CashbookBalance
dr(2) = 23 'GET_DATAVALUE("", conn) 'ChequesdrawnNotcleared
dr(3) = 24 'GET_DATAVALUE("", conn) 'ChequesreceivedNotcleared
dt.Rows.Add(dr)
frmReportviewer.PrintReport(dt, "rptReconciliation.rpt")
答案 0 :(得分:0)
dim strDate作为日期 strDate =格式(dtpMonthOf.Value,“dd-MM-yyyy”)
Dim dt As New DataTable Dim q1,q2 As String q1 =“SELECT SUM(当AdjustFlag ='D'时为CASE,然后0-Amount,其他数量为End)为total,rp.TransactionCode,rp.ReferenceDate,rp.TransactionFlag,rp.EncashDate”&amp; _ “FROM dbo.ReceiptsPayments rp,dbo.ReceiptsPaymentsDetail rd”&amp; _ “WHERE rp.TransactionCode = rd.TransactionCode AND(rp.EncashDate为NULL或rp.EncashDate&gt; strDate)AND TransactionFlag ='P'Group(BY)rp.TransactionCode,rp.ReferenceDate,rp.TransactionFlag,rp.EncashDate”
q2 = "SELECT SUM(CASE when AdjustmentFlag='D' then 0-Amount else Amount end)as total " & _
"FROM ReceiptsPayments rp, ReceiptsPaymentsDetail rd " & _
"WHERE rp.TransactionCode = rd.TransactionCode and ReferenceDate <= '" & strDate & "'" & _
"AND TransactionFlag = 'P'"
dt.Columns.Add("ReconciliationDate", System.Type.GetType("System.DateTime"), "")
dt.Columns.Add("CashbookBalance", System.Type.GetType("System.Double"), "")
dt.Columns.Add("ChequesdrawnnotCleared", System.Type.GetType("System.Int32"), "")
dt.Columns.Add("ChequesreceivedNotCleared", System.Type.GetType("System.Int32"), "")
Dim dr(3) As Object
dr(0) = strDate 'ReconciliationDate
dr(1) = GET_DATAVALUE(q2, conn) 'CashbookBalance
dr(2) = 23 'GET_DATAVALUE("", conn) 'ChequesdrawnNotcleared
dr(3) = 24 'GET_DATAVALUE("", conn) 'ChequesreceivedNotcleared
dt.Rows.Add(dr)
frmReportviewer.PrintReport(dt, "rptReconciliation.rpt")