Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Tenho uma select que faz a busca de contas à pagar e contas à receber.
Como faço para quando não tiver Valor à Receber em um dos dias da SELECT, para o sistema preencher a coluna com valor R$ 0,00 ao invés de pular o dia ?
SQLstring2= " SET DATEFORMAT DMY "&_
" SELECT day (TR.Data_ContaReceber) As DIA, month(TR.Data_ContaReceber) AS MÊS, "&_
" year(TR.Data_ContaReceber) AS ANO, SUM(TR.Valor_ContaReceber)AS RECEBER "&_
" FROM TContaReceber TR WHERE TR.Data_ContaReceber BETWEEN "&_
" '"&DATA_INI&"' and '"&DATA_FIM&"' "&_
" GROUP BY day (Data_ContaReceber), month(Data_ContaReceber), year(Data_ContaReceber) "&_
" ORDER BY year(Data_ContaReceber), month(Data_ContaReceber), day (Data_ContaReceber) "
Set rsQuery2 = Conn.Execute(SQLstring2)
IF NOT rsQuery.Eof Then
While Not rsQuery.Eof
TPagar = TPagar + rsQuery("PAGAR")
TReceber = TReceber + rsQuery2("RECEBER")
SALDO = rsQuery("PAGAR") - rsQuery2("RECEBER")
TSaldo = TSaldo + SALDO
%>
<tr class="style3">
<td width="30"> </td>
<td width="51" align="center"> <% = rsQuery("DIA") %>/<% = rsQuery("MÊS") %>/<% = rsQuery("ANO") %></td>
<td width="230" align="right"> R$ </td>
<td width="230" align="right"><%=FormatNumber(rsQuery("PAGAR"),2)%> </td>
<td width="263" align="right"> R$ </td>
<td width="263" align="right"><%=FormatNumber(rsQuery2("RECEBER"),2)%> </td>
<td width="230" height="25" align="right"> R$ </td>
<td width="230" align="right"><%=FormatNumber(SALDO,2)%></td>
</tr>
<%
rsQuery.MoveNext
rsQuery2.MoveNext
Wend
End IfCarregando comentários...