Proplemas Com Totalização
Preciso de uma ajuda pra resolver um problema de totalização. Quando ele acha somente um Registro ele não exibe a totalização.
Abaixo segue o link da apl rodando: Escolham a data 23/01/2008
http://www.cellsoft.com.br/pcpteste/listag...uzido_fabor.asp
Veja o problema a partir da linha #35
Abaixo segue o codigo do Endemoniado. rs
str_cabecalho = "<table width='800' border='0' align='center' cellpadding='0' cellspacing='0' style='"&estilo_tab&"'>"&_
"<tr bgcolor='#A08365' class='font37' align='center'> "&_
" <td colspan='10' height='20'>Analise de Desvios da Programação e o Produzido do Dia" & data_br & "</td> "&_
" </tr> "&_
" <tr bgcolor='#FFFFCC' class='font7' align='center'> "&_
" <td width='55' rowspan='2' valign='bottom' style='"&estilo_cel&"'>#</td> "&_
" <td colspan='2' style='"&estilo_cel&"'>Solado</td> "&_
" <td width='62' rowspan='2' style='"&estilo_cel&"'>Turno</td> "&_
" <td width='73' rowspan='2' style='"&estilo_cel&"'>Prensa</td> "&_
" <td width='80' rowspan='2' style='"&estilo_cel&"'>Tamanho</td> "&_
" <td colspan='2' style='"&estilo_cel&"'>Total de pares </td> "&_
" <td colspan='2' style='"&estilo_cel_1&"'>Desvio</td> "&_
" </tr> "&_
" <tr bgcolor='#FFFFCC' class='font7' align='center'> "&_
" <td width='61' style='"&estilo_cel&"'>Modelo</td> "&_
" <td width='112' style='"&estilo_cel&"'>Cor</td> "&_
" <td width='102' style='"&estilo_cel&"'>Programado</td> "&_
" <td width='94' style='"&estilo_cel&"'>Produzido</td> "&_
" <td width='86' style='"&estilo_cel&"'>Qtd. Pares </td> "&_
" <td width='75' style='"&estilo_cel_1&"'>%</td> "&_
" </tr> "
response.Write(str_cabecalho)
i = 0
seq = 1
total_turno_prog = Clng(0)
total_turno_prod = Clng(0)
total_prensa_prog = Clng(0)
total_prensa_prod = Clng(0)
total_dia_prog = Clng(0)
total_dia_prod = Clng(0)
total_geral_dia_prog = Clng(0)
total_geral_dia_prod = Clng(0)
Set rs_pesq = Server.CreateObject("AdoDB.RecordSet")
rs_pesq.open sql_pesq, db_info
rs_pesq.MoveFirst
pi_modelo_corrente = rs_pesq("campo")
turno_corrente = rs_pesq("campo")
prensa_corrente = rs_pesq("campo")
Do while not rs_pesq.eof
if (i mod 2 = 0) then
cor = "#CCE6E6"
else
cor = "#E6F2F2"
end if
pi_modelo = rs_pesq("campo")
pi_cor = rs_pesq("campo")
turno = rs_pesq("campo")
prensa = rs_pesq("campo")
pi_tamanho = rs_pesq("campo")
programado = Clng(rs_pesq("campo"))
produzido = Clng(rs_pesq("campo"))
qtd_pares_desv = Clng(rs_pesq("campo"))
qtd_pares_per = Clng(rs_pesq("campo"))
''fl_cabecalho = false
if(prensa_corrente <> prensa)then
str_prensa = "<tr bgcolor='#A08365' class='font37' align='center'>"&_
"<td colspan='3' style='"& estilo_cel &"'>Total Prensa " & prensa_corrente & ": </td>"&_
"<td style='"& estilo_cel &"'> </td>"&_
"<td style='"& estilo_cel &"'> </td>"&_
"<td style='"& estilo_cel &"'> </td>"&_
"<td style='"& estilo_cel &"'>"&FormatNumber(total_prensa_prog,0)&"</td>"&_
"<td style='"& estilo_cel &"'>"&FormatNumber(total_prensa_prod,0)&"</td>"&_
"<td style='"& estilo_cel &"'> </td>"&_
"<td style='"& estilo_cel_1 &"'> </td>"&_
"</tr>"
response.write(str_prensa)
total_prensa_prog = programado
total_prensa_prod = produzido
prensa_corrente = prensa
else
total_prensa_prog = total_prensa_prog + programado
total_prensa_prod = total_prensa_prod + produzido
end if
if(turno_corrente <> turno)then
str_turno = "<tr bgcolor='#A08365' class='font37' align='center'>"&_
"<td colspan='3' style='"& estilo_cel &"'>Total Turno " & turno_corrente & ": </td>"&_
"<td style='"& estilo_cel &"'> </td>"&_
"<td style='"& estilo_cel &"'> </td>"&_
"<td style='"& estilo_cel &"'> </td>"&_
"<td style='"& estilo_cel &"'>"&FormatNumber(total_turno_prog,0)&"</td>"&_
"<td style='"& estilo_cel &"'>"&FormatNumber(total_turno_prod,0)&"</td>"&_
"<td style='"& estilo_cel &"'> </td>"&_
"<td style='"& estilo_cel_1 &"'> </td>"&_
"</tr>"
response.write(str_turno)
total_turno_prog = programado
total_turno_prod = produzido
turno_corrente = turno
else
total_turno_prog = total_turno_prog + programado
total_turno_prod = total_turno_prod + produzido
end if
if(pi_modelo_corrente <> pi_modelo)then
response.Write("</table><br>")
total_dia_prog = programado
total_dia_prod = produzido
response.Write(str_cabecalho)
pi_modelo_corrente = pi_modelo
''fl_cabecalho = true
else
total_dia_prog = total_dia_prog + programado
total_dia_prod = total_dia_prod + produzido
end if
%>
<tr bgcolor="<% =cor %>">
<td align="center" style="<% =estilo_cel %>"><% =seq %></td>
<td align="center" style="<% =estilo_cel %>"><% =pi_modelo %></td>
<td align="center" style="<% =estilo_cel %>">
<%
if(pi_cor <> "")then
sql_cor = " SELECT BV_CHAVE AS PI_COMBINACAO, RTRIM(BV_DESCRI) AS DESCRICAO "&_
" FROM DADOSADV.dbo.SB4100 AS SB4 INNER JOIN DADOSADV.dbo.SBV100 AS SBV ON BV_TABELA = B4_LINHA "&_
" WHERE B4_FILIAL = '' AND Rtrim(B4_COD)+''+BV_CHAVE LIKE '"&pi_modelo&"-"&pi_cor&"%' AND SB4.D_E_L_E_T_ <> '*' AND "&_
" SBV.D_E_L_E_T_ <> '*' "
''response.write(sql_cor)
Set rs_cor = Server.CreateObject("AdoDB.RecordSet")
rs_cor.open sql_cor, db_info
str_cor = split(rs_cor("DESCRICAO"), "-")
descricao = pi_cor& " - " & trim(str_cor(0))
response.Write(descricao)
end if
%>
</td>
<td align="center" style="<% =estilo_cel %>"><% =turno %></td>
<td align="center" style="<% =estilo_cel %>"><% =prensa %></td>
<td align="center" style="<% =estilo_cel %>"><% =pi_tamanho %></td>
<td align="center" style="<% =estilo_cel %>"><% =programado %></td>
<td align="center" style="<% =estilo_cel %>"><% =produzido %></td>
<td align="center" style="<% =estilo_cel %>"><% =qtd_pares_desv %></td>
<td align="center" style="<% =estilo_cel_1 %>"><% =qtd_pares_per %></td>
</tr>
<%
i = i + 1
seq = seq + 1
rs_pesq.MoveNext
''if(rs_pesq.eof and fl_cabecalho)then
''if(fl_cabecalho)then
''response.Write("aki")
''IMPRIMIR O CABÇALHO
''response.write(str_total)
''fl_cabecalho = false
''end if
Loop
str_prensa = "<tr bgcolor='#A08365' class='font37' align='center'>"&_
"<td colspan='3' style='"& estilo_cel &"'>Total Prensa " & prensa_corrente & ": </td>"&_
"<td style='"& estilo_cel &"'> </td>"&_
"<td style='"& estilo_cel &"'> </td>"&_
"<td style='"& estilo_cel &"'> </td>"&_
"<td style='"& estilo_cel &"'>"&FormatNumber(total_prensa_prog,0)&"</td>"&_
"<td style='"& estilo_cel &"'>"&FormatNumber(total_prensa_prod,0)&"</td>"&_
"<td style='"& estilo_cel &"'> </td>"&_
"<td style='"& estilo_cel_1 &"'> </td>"&_
"</tr>"
str_turno = "<tr bgcolor='#A08365' class='font37' align='center'>"&_
"<td colspan='3' style='"& estilo_cel &"'>Total Turno " & turno_corrente & ": </td>"&_
"<td style='"& estilo_cel &"'> </td>"&_
"<td style='"& estilo_cel &"'> </td>"&_
"<td style='"& estilo_cel &"'> </td>"&_
"<td style='"& estilo_cel &"'>"&FormatNumber(total_turno_prog,0)&"</td>"&_
"<td style='"& estilo_cel &"'>"&FormatNumber(total_turno_prod,0)&"</td>"&_
"<td style='"& estilo_cel &"'> </td>"&_
"<td style='"& estilo_cel_1 &"'> </td>"&_
"</tr>"
''if(rs_pesq.eof)then
response.write(str_prensa)
response.write(str_turno)
''response.write(str_dia)
''end if
response.Write("</table><br>")
Se alguem puder me dar um help!!!
Agradeço desde já!
Discussão (2)
Carregando comentários...