Ir para conteúdo
Fórum Script Brasil
  • 0

Imprimindo tabelas coloridas


Clauido José

Pergunta

6 respostass a esta questão

Posts Recomendados

  • 0

é isso valeu obrigado.

Aproveitando este tópico,estou com uma duvida tenho um sistema feito em asp, e tenho que fazer um relatorio, buscando dados de uma tabela Sql Server, bom isso já to fazendo, minha duvida é como faço pra impirmir sem que mostre os botões Imprimir e Fechar quero que imprima somente o conteudo do relatorio.

Editado por Clauido José
Link para o comentário
Compartilhar em outros sites

  • 0

estou fazendo da seguinte maneira.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Relatorio de Ordem de Servi&ccedil;os</title>
<script>
    function fechar(){
        if (window.confirm("Deseja sair do relatorio?")){
            document.location="default.asp"
        }
    }
    function Imprimindo(){
        if (window.confirm("Deseja imprimir este relatorio")){
            window.print();
        }
    }
</script>
<link href="css/estilos.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
    margin-left: 3px;
    margin-top: 3px;
    margin-right: 3px;
    margin-bottom: 3px;
}
-->
</style></head>
    <body>
    <!--#include file="strcon.asp"-->
    <%
    call abreConexao()
    Server.ScriptTimeout = 999999
    sEmpresa = Request("sEmpresa")
    sTecnico = Request("sTecnico")
    sServico = Request("sServico")
    sTipo = Request("sTipo")
    sData = Request("sData")
    dia = day(sdata)
    mes = month(sdata)
    ano = year(sdata)    
    data = (ano&"/"&mes&"/"&dia)
    Sql = "Select * from tabDth where tabDth.DatCompromisso='" & Data & "'"
    if sServico<>"" then Sql = Sql & " and tabDth.idServico = " & sServico
    if sEmpresa<>"" then Sql = Sql & " and tabDth.idEmpresa = " & sEmpresa 
    if sTecnico<>"" then Sql = Sql & " and tabDth.idTecnico = " & sTecnico
    if sTipo=1 then Sql = Sql & " and tabDth.idEmpresa<>0 or idTecnico<>0 " else if sTodos=2 then Sql = Sql & " and tabDth.idEmpresa=0 and idTecnico=0 "
    Sql =Sql & " order by tabDth.idTecnico,tabDth.idEmpresa,tabDth.idServico "

    if rsBusca.State = 1 then rsBusca.close
    rsBusca.Open Sql,conexao,1,1
    if rsBusca.Eof then
        Response.Write("<script>")
        Response.Write("alert('Não foram atribuidos dados para esta empresa');")
        Response.Write("history.back();")
        Response.Write("</script>")
    else
    %>    
    <table width="730" height="299" border="0" align="center" cellpadding="0" cellspacing="0">
          <form name="form1" method="post" action="">
            <tr>
                <td height="20" colspan="3"><table width="848" border="0" cellpadding="2" cellspacing="2">
                    <tr>
                        <td height="19" colspan="3" align="right">&nbsp;</td>
                    </tr>
                    <tr>
                        <td width="45%" height="24" align="right"><input name="butImprimi" type="button" id="butImprimi" value="IMPRIMIR" onClick="Imprimindo();"></td>
                        <td width="5%" align="center">&nbsp;</td>
                        <td width="45%"><input name="butFechar" type="button" id="butFechar" value="  FECHAR  " onClick="fechar();"></td>
                    </tr>
                </table></td>
            </tr>
          </form>
        <tr>
            <td colspan="9"><div id="conteudo"><table width="850" border="0" cellpadding="2" cellspacing="2">
                <%
                i = 1
                sTotalServico=0
                sTotalPontos=0
                idTecnico=rsBusca("idTecnico")
                DO while not rsBusca.eof
                %>
                    <tr>
                        <td colspan="9"><table width="850" border="0" cellpadding="2" cellspacing="2" class="Tabela">
                            <%if Bg="#BDD1D2" then Bg="#4682B4" else Bg="#BDD1D2" end if
                            if i = 3 or rsBusca("idTecnico")<>idTecnico then%>
                                <tr>
                                    <td colspan="7" bgcolor="<%=bg%>" class="SubTitulo">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td colspan="7" bgcolor="<%=bg%>" class="SubTitulo">&nbsp;</td>
                                </tr>
                                <tr style="page-break-before:always;">
                                    <td colspan="7" bgcolor="<%=bg%>" class="SubTitulo">&nbsp;</td>
                                </tr>
                            <%    i= 0
                                idTecnico=rsBusca("idTecnico")
                            elseif rsBusca("idTecnico")=idTecnico then
                            %>
                            <tr>
                                <td colspan="7" bgcolor="<%=bg%>" class="SubTitulo">&nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="7" bgcolor="<%=bg%>" class="SubTitulo">&nbsp;</td>
                            </tr>                            
                            <tr>
                                <td colspan="7" bgcolor="<%=bg%>" class="SubTitulo"><h3>RELATORIO DE ORDEM DE SERVI&Ccedil;O </h3></td>
                            </tr>                            
                            <tr>
                                <td colspan="7"><table width="100%" border="0" cellpadding="2" cellspacing="2" class="tblBoderP">
                                    <%if Bg="#BDD1D2" then Bg="#4682B4" else Bg="#BDD1D2" end if%>
                                    <tr>
                                        <td bgcolor="<%=bg%>" class="SubTitulo"><table width="100%" border="0" cellspacing="2" cellpadding="2">
                                            <tr>
                                                <td width="4%">TA:</td>
                                                <td width="11%"><%=rsBusca("NoTa")%></td>
                                                <td width="6%">SERVI&Ccedil;O:</td>
                                                <td width="9%"><%=rsBusca("CODSERVICO")%></td>
                                                <td width="7%">PERIODO:</td>
                                                <td width="9%"><%=rsBusca("PERIODO")%></td>
                                                <td width="16%">DATA DE SOLICITA&Ccedil;&Atilde;O:</td>
                                                <td width="10%"><%=rsBusca("datSolicitada")%></td>
                                                <td width="17%">DATA DE COMPROMISSO:</td>
                                                <td width="11%"><%=rsBusca("datCompromisso")%></td>
                                            </tr>
                                        </table></td>
                                    </tr>
                                    <%
                                    if Bg="#BDD1D2" then Bg="#4682B4" else Bg="#BDD1D2" end if
                                    if rsBusca("idEmpresa")<>0 then
                                        sSql = "Select * from tabEmpresa where Empresa=" & rsBusca("idEmpresa")
                                        if rsEmpresa.state=1 then rsEmpresa.Close
                                        rsEmpresa.Open sSql,Conexao,1,1
                                        if rsEmpresa.RecordCount>0 then sEmpresa=rsEmpresa("Responsavel")
                                    end if
                                    %>
                                    <tr>
                                        <td class="SubTitulo"><table width="100%" border="0" cellspacing="2" cellpadding="2">
                                            <tr>
                                                <td bgcolor="<%=bg%>" width="6%">CODIGO:</td>
                                                <td bgcolor="<%=bg%>" width="9%"><%=rsBusca("NoOs")%></td>
                                                <td bgcolor="<%=bg%>" width="7%">EMPRESA:</td>
                                                <td bgcolor="<%=bg%>" width="78%"><%=sEmpresa%></td>
                                            </tr>
                                        </table></td>
                                    </tr>
                                    <%
                                    if Bg="#BDD1D2" then Bg="#4682B4" else Bg="#BDD1D2" end if
                                        Sql = "select * from tabCliente where NoOs = " & rsBusca("NoOs")
                                        if rsCliente.state=1 then rsCliente.Close
                                        rsCliente.Open Sql,Conexao,1,1
                                        if rsCliente.RecordCount>0 then
                                            sCliente=rsCliente("NomeCliente")
                                            sEndereco=rsCliente("Endereco")
                                            sBairro=rsCliente("Bairro")
                                            sCep=rsCliente("Cep")
                                            sTerminal=rsCliente("Terminal")
                                            sTipoRes=rsCliente("TipoResidencia")
                                        end if
                                    %>
                                    <tr>
                                        <td class="SubTitulo"><table width="100%" border="0" cellspacing="2" cellpadding="2">
                                            <tr>
                                                <td bgcolor="<%=bg%>" width="7%">CLIENTE:</td>
                                                <td bgcolor="<%=bg%>" width="29%"><%=sCliente%></td>
                                                <td bgcolor="<%=bg%>" width="7%">&nbsp;</td>
                                                <td bgcolor="<%=bg%>" width="6%">&nbsp;</td>
                                                <td bgcolor="<%=bg%>" width="9%">&nbsp;</td>
                                                <td bgcolor="<%=bg%>" width="10%">&nbsp;</td>
                                                <td bgcolor="<%=bg%>" width="6%">&nbsp;</td>
                                                <td bgcolor="<%=bg%>" width="26%">&nbsp;</td>
                                            </tr>
                                            <tr>
                                                <td bgcolor="<%=bg%>">ENDERE&Ccedil;O:</td>
                                                <td bgcolor="<%=bg%>"><%=sEndereco%></td>
                                                <td bgcolor="<%=bg%>" align="right">No.:</td>
                                                <td bgcolor="<%=bg%>"><%=sNUMERO%></td>
                                                <td bgcolor="<%=bg%>" align="right">CEP:</td>
                                                <td bgcolor="<%=bg%>"><%=sCep%></td>
                                                <td bgcolor="<%=bg%>" align="right">BAIRRO:</td>
                                                <td bgcolor="<%=bg%>"><%=sBairro%></td>
                                            </tr>
                                            <tr>
                                                <td bgcolor="<%=bg%>">CIDADE:</td>
                                                <td bgcolor="<%=bg%>"><%=sCidade%></td>
                                                <td bgcolor="<%=bg%>">ESTADO:</td>
                                                <td bgcolor="<%=bg%>"><%=sEstado%></td>
                                                <td bgcolor="<%=bg%>">RESID&Ecirc;NCIA:</td>
                                                <td bgcolor="<%=bg%>"><%=sTipoRes%></td>
                                                <td bgcolor="<%=bg%>">TERMINAL:</td>
                                                <td bgcolor="<%=bg%>"><%=sTerminal%></td>
                                            </tr>
                                        </table></td>
                                    </tr>
                                    <%
                                    if Bg="#BDD1D2" then Bg="#4682B4" else Bg="#BDD1D2" end if
                                    if rsBusca("idTecnico")<>0 then
                                        sSql = "Select * from tabTecnicos where idTecnico=" & rsBusca("idTecnico")
                                        if rsTecnicos.state=1 then rsTecnicos.Close
                                        rsTecnicos.Open sSql,Conexao,1,1
                                        if rsTecnicos.RecordCount>0 then
                                            sRe=rsTecnicos("RE")
                                            sNomeTecnico=rsTecnicos("NomeTecnico")
                                        end if
                                    end if
                                    if rsBusca("idTipoOs")<>0 then
                                        sSql = "Select * from tabTipoOs where idTipoOs=" & rsBusca("idTipoOs")
                                        if rsTipoOs.State= 1 then rsTipoOs.Close
                                        rsTipoOs.Open sSql, Conexao,1,1
                                        if rsTipoOs.RecordCOunt>0 then sTipoOs=rsTipoOs("Descricao")
                                    end if
                                    %>
                                    <tr>
                                        <td bgcolor="<%=bg%>" class="SubTitulo"><table width="100%" border="0" cellspacing="2" cellpadding="2">
                                            <tr>
                                                <td bgcolor="<%=bg%>" width="9%">RE:</td>
                                                <td bgcolor="<%=bg%>" width="11%"><%=sRe%></td>
                                                <td bgcolor="<%=bg%>" width="7%">TECNICO:</td>
                                                <td bgcolor="<%=bg%>" colspan="3"><%=sNomeTecnico%></td>
                                                <td bgcolor="<%=bg%>" width="15%" align="right">TIPO DE OS: </td>
                                                <td bgcolor="<%=bg%>" width="19%"><%=sTipoOs%></td>
                                            </tr>
                                            <tr>
                                                <td bgcolor="<%=bg%>">PRODUTO:</td>
                                                <td bgcolor="<%=bg%>"><%=sProdutos%></td>
                                                <td bgcolor="<%=bg%>">PONTOS:</td>
                                                <td bgcolor="<%=bg%>" width="11%"><%=rsBusca("ContagemDia")%></td>
                                                <td bgcolor="<%=bg%>" width="7%">PACOTE</td>
                                                <td bgcolor="<%=bg%>" width="21%"><%=rsBusca("Pacote")%></td>
                                                <td bgcolor="<%=bg%>">CONTAGEM DE DIAS: </td>
                                                <td bgcolor="<%=bg%>"><%=rsBusca("QtdPontos")%></td>
                                            </tr>
                                        </table></td>
                                    </tr>
                                    <%if Bg="#BDD1D2" then Bg="#4682B4" else Bg="#BDD1D2" end if%>
                                    <tr>
                                        <td bgcolor="<%=bg%>" class="SubTitulo"><table width="100%" border="0" cellspacing="2" cellpadding="2">
                                            <tr>
                                                <td width="6%">TAREFAS</td>
                                                <td width="94%" rowspan="2"><%=rsBusca("Tarefa")%></td>
                                            </tr>
                                            <tr>
                                                <td>&nbsp;</td>
                                            </tr>
                                        </table></td>
                                    </tr>
                                    <%if Bg="#BDD1D2" then Bg="#4682B4" else Bg="#BDD1D2" end if%>
                                    <tr>
                                        <td bgcolor="<%=bg%>" class="SubTitulo"><table width="100%" border="0" cellspacing="2" cellpadding="2">
                                            <tr>
                                                <td width="9%">OBSERVA&Ccedil;&Atilde;O:</td>
                                                <td width="91%" rowspan="2" valign="top"><%=rsBusca("Observacao")%></td>
                                            </tr>
                                            <tr>
                                                <td>&nbsp;</td>
                                            </tr>
                                        </table></td>
                                    </tr>
                                    <%if Bg="#BDD1D2" then Bg="#4682B4" else Bg="#BDD1D2" end if%>
                                    <tr>
                                        <td bgcolor="<%=bg%>" class="SubTitulo"><table width="100%" border="0" cellspacing="2" cellpadding="2">
                                            <tr>
                                                <td width="12%">INF. ADICIONAIL: </td>
                                                <td width="88%" rowspan="2" valign="top"><%=rsBusca("InfoAdcionais")%></td>
                                            </tr>
                                            <tr>
                                                <td>&nbsp;</td>
                                            </tr>
                                        </table></td>
                                    </tr>
                                    <%if Bg="#BDD1D2" then Bg="#4682B4" else Bg="#BDD1D2" end if%>
                                    <tr>
                                        <td bgcolor="<%=bg%>" class="SubTitulo"><table width="100%" border="0" cellspacing="2" cellpadding="2">
                                            <tr>
                                                <td width="8%">DESCRI&Ccedil;&Atilde;O:</td>
                                                <td width="92%" rowspan="2" valign="top"><%=rsBusca("Descricao")%></td>
                                            </tr>
                                            <tr>
                                                <td>&nbsp;</td>
                                            </tr>
                                        </table></td>
                                    </tr>
                                    <%if Bg="#BDD1D2" then Bg="#4682B4" else Bg="#BDD1D2" end if%>
                                    <tr>
                                        <td bgcolor="<%=bg%>" class="SubTitulo"><table width="100%" border="0" cellspacing="2" cellpadding="2">
                                            <tr>
                                                <td width="12%">No. Os Garantia: </td>
                                                <td width="18%"><%=rsBusca("NoGarantia")%></td>
                                                <td width="19%">DATA BAIXA GARANTIA: </td>
                                                <td width="21%"><%=rsBusca("DtDatBaiGarantia")%></td>
                                                <td width="15%">TECNICO GARANTIA: </td>
                                                <td width="15%"><%=rsBusca("TecnicoGarantia")%></td>
                                            </tr>
                                        </table></td>
                                    </tr>
                                </table></td>
                            </tr>
                        </table></td>
                    </tr>
                <%    
                    end if
                    i = i +1            
                    rsBusca.MoveNext
                loop
                %>
            </table></div></td>
        </tr>
    </table>
    <%    
    end if
    %>
    </body>
</html>

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...