0

strdate は日付です

Dim dt As New DataTable Dim q1, q2 As String q1 = "SELECT SUM(CASE when AdjustmentFlag= 'D' then 0-Amount else Amount End) as 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")
4

1 に答える 1

0

日付として strDate を暗くする strDate = Format(dtpMonthOf.Value, "dd-MM-yyyy")

Dim dt As New DataTable Dim q1, q2 As String q1 = "合計、rp.TransactionCode、rp.ReferenceDate、rp.TransactionFlag、rp.EncashDateとしてSUM(AdjustmentFlag= 'D'の場合はCASE、0-Amount、それ以外の場合はAmount End)を選択" & _ " 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.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")
于 2013-06-12T07:08:31.667 に答える