그래서 SQL을 통해 데이터를 검색하고 명령문 페이지를 찾습니다. 고객, 날짜, 거래, 직불, 신용 및 잔액 항목이 있습니다. 이제 신용 및 대변이 아닌 거래의 경우 표시되지 않습니다.SQL이 데이터를 검색/표시하지 않습니다.
예 : - 당신은 크레딧이 표시되지 않는 볼 수 있습니다 위 http://oi57.tinypic.com/16m1yeq.jpg
확인 이미지. 표시되지 않는 이유에 대한 문제가있는 경우 도와주세요! "nDrTotal"을 수정하는 코드에 뭔가가 있다는 것을 알고 있습니다. & nCrTotal
고마워요! 질문은 ... 음수 금액이 차변 테이블에 표시되지 않는 이유는 무엇입니까?
Function ApplyStatementDetails(ByVal sContent As String, ByVal sClientID As String, ByVal sDate As String, ByVal sSection As String) As String
Dim sSQL As String, sOut As String, rsStatement As SqlDataReader, sHTML As String = "", iLines As Integer, iCount As Integer
Dim nInvTotal As Double, n90Days As Double = 0, n60Days As Double = 0, n30Days As Double = 0, nCurrent As Double = 0, dCompareDate As Date
Dim nBalance As Double = 0
sOut = ApplyCompanyDetails(sContent)
'response.write sSQl: response.end
rsStatement = New SqlCommand(sSQL, cnStatemnt).ExecuteReader
Dim bFirst As Boolean = True, sClient As String = "", sAddress As String = ""
Dim nDRTotal As Double = 0, nCRTotal As Double = 0, nPaymentsAlloc As Double = 0
Do While rsStatement.Read
If bFirst Then
iCount = 0
sClient = EmptyIfNull(rsStatement("Company"))
If sClient = "" Then sClient = EmptyIfNull(rsStatement("Salutation"))
sAddress = DesignAddress(rsStatement("Address1"), rsStatement("Address2"), rsStatement("Address3"), rsStatement("Address4"), rsStatement("Postcode"))
sOut = Replace(sOut, "$$Client_ID$$", sClientID)
sOut = Replace(sOut, "$$Client_Name$$", nbspIfEmpty(sClient))
sOut = Replace(sOut, "$$Client_Address$$", sAddress)
If Request.QueryString("date") <> "" Then
sOut = Replace(sOut, "$$Statement_Date$$", Request.QueryString("date"))
Else
sOut = Replace(sOut, "$$Statement_Date$$", sDate)
End If
bFirst = False
End If
nDRTotal = Math.Round(ZeroIfNull(rsStatement("InvoicesPH")) + ZeroIfNull(rsStatement("InvoicesContract")) + ZeroIfNull(rsStatement("InvoicesFE")) + ZeroIfNull(rsStatement("InvoicesCMP")), 2)
If nDRTotal = 0 Then
nCRTotal = ZeroIfNull(rsStatement("Payments"))
nPaymentsAlloc = -ZeroIfNull(rsStatement("CreditsAlloc"))
nInvTotal = Math.Round(-nPaymentsAlloc - nCRTotal, 2)
Else
nCRTotal = -ZeroIfNull(rsStatement("Payments")) + ZeroIfNull(rsStatement("Adjustments")) + ZeroIfNull(rsStatement("Credits")) - ZeroIfNull(rsStatement("CreditsAlloc"))
nPaymentsAlloc = 0
Select Case rsStatement("Type")
Case "TR", "CH", "CA", "CC"
nPaymentsAlloc = GetPaymentsAlloc(rsStatement("InvoiceNo"))
End Select
nInvTotal = Math.Round(ZeroIfNull(rsStatement("InvoicesPH")) + ZeroIfNull(rsStatement("InvoicesContract")) + ZeroIfNull(rsStatement("InvoicesFE")) + ZeroIfNull(rsStatement("InvoicesCMP")) - ZeroIfNull(rsStatement("Payments")) + ZeroIfNull(rsStatement("Adjustments")) + ZeroIfNull(rsStatement("Credits")) - ZeroIfNull(rsStatement("CreditsAlloc")) + nPaymentsAlloc, 2)
End If
'
If nInvTotal <> 0 Then
iLines = iLines + 10
sHTML = sHTML & "<tr><td class=""data"" align=""center"">" & FormatDate(rsStatement("InvoiceDate"), sDateFormat) & "</td>" & _
"<td class=""data"">" & FormatRef(rsStatement("Type"), rsStatement("InvoiceNo")) & "</td>" & _
"<td class=""data"" align=""right"">" & ShowValue(nDRTotal, rsStatement("Type"), "DR") & "</td>" & _
"<td class=""data"" align=""right"">" & ShowValue(nCRTotal, "CR", "CR") & "</td>" & _
"<td class=""data"" align=""right"">" & ShowValue(nInvTotal, rsStatement("Type"), "TOTAL") & "</td></tr>"
'"<td class=""data"" align=""right"">" & ShowValue(nDRTotal + nCRTotal + nPaymentsAlloc, rsStatement("Type"), "TOTAL") & "</td></tr>"
dCompareDate = rsStatement("InvoiceDate")
' 12/11/13 changed statement ageing to days base for statements dated mid-month MB
If DateDiff("d", dCompareDate, CDate(sDate)) >= 90 Then
n90Days = n90Days + nInvTotal
ElseIf DateDiff("d", dCompareDate, CDate(sDate)) >= 60 Then
n60Days = n60Days + nInvTotal
ElseIf DateDiff("d", dCompareDate, CDate(sDate)) >= 30 Then
n30Days = n30Days + nInvTotal
Else
nCurrent = nCurrent + nInvTotal
End If
End If
Loop
sOut = Replace(sOut, "$$Statement_Data$$", sHTML)
sOut = Replace(sOut, "$$90Days_Amount$$", ShowBalance(n90Days))
sOut = Replace(sOut, "$$60Days_Amount$$", ShowBalance(n60Days))
sOut = Replace(sOut, "$$30Days_Amount$$", ShowBalance(n30Days))
sOut = Replace(sOut, "$$Current_Amount$$", ShowBalance(nCurrent))
sOut = Replace(sOut, "$$Total_Amount$$", ShowBalance(n90Days + n60Days + n30Days + nCurrent))
rsStatement.Close() : rsStatement = Nothing
If sSection <> "" Then
ApplyStatementDetails = GetDocumentSection(sOut, "all") & GetDocumentSection(sOut, sSection)
Else
ApplyStatementDetails = sOut
End If
End Function
질문의 형식을 지정하십시오. 또한 인라인 SQL 대신 SP를 사용하지 마십시오 – Seminda
@Seminda 위의 질문에 – user3566985
사용자 입력 신뢰와 같은 몇 가지 보안 취약점이 있습니다 : 'Out = Replace (sOut, "$$ Statement_Date $$", Request.QueryString ("date"))' – ErikE