<?php 
	require('ferramentas.php'); 
	// ob_start();
?>
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'>
<HTML lang="pt-br">
    <script language="Javascript">
        function doprint() {
            window.print(); //true -> exibe a janela para escolher o tamanho do papel; false -> nao exibe
        }
    </script>

    <?php
    $codfirma = $_REQUEST["id"];
    $codrec   = $_REQUEST["rec"];
    $ref      = $_REQUEST["ref"];
    $doc      = "";
    $multa    = "";
    $cob      = "";
	
    $row = guia_recolhimento($codfirma,$codrec,$ref);
    grava_log($codfirma,"Impressao:".$codrec.",".$ref);

    $referencia = 'Ref.: '.$ref;
    $dataven    = $row['datven'];
    $data_doc   = $row['datagerado'];
    $nossonum   = $row['nossonum'];
    $linha      = $row['reg1'];
    $codbarra   = $row['reg'];
    $numdoc     = $row['nossonum'];
    $nfunc      = '';
    if (isset($row['nroempregados']) && $row['nroempregados'] > 0) {
      $nfunc = 'Nº Func.: '.$row['nroempregados'];
    }

	  $doc        = $row['valpre'];
	  if (!empty($doc)) {
		  $doc = str_replace(",",".",$doc);
		  $doc = number_format($doc,2, ',', '.'); 
	  }
	  if ($doc=='0') {
		  $doc = '';
	  }	

    $tr         = $row['tiporec'];
    $men1       = $tr['instrucao'];
    $banco      = $tr['banco'];
    $nome_primeiro_cedente    = $banco['nomecedente1'];
    $nome_segundo_cedente     = $banco['nomecedente2'];
    $codigo_cedente           = $banco['nroagencia']."/".$banco['nrocedente'];
    $descricao_carteira       = $banco['carteiraimpressao'];
	$nrobanco                 = $banco['nrobanco'];
	$localpagamento           = $banco['localpagamento']; 	

    $emp        = $row['empresa'];
    $nome       = $emp['nome'];
    $ncadastro  = $emp['ncadastro'];
    $end_bairro = $emp['endereco'] . ", " . $emp['numero']. " Bairro " . $emp['bairro'] . " CEP " . $emp['cep'];

    $cid        = $emp;
    $cid_est = $cid['nomecidade'] . " - " . $cid['uf'];

    ?>
    <HEAD>
        <TITLE>Guia de Recolhimento Assistencial</TITLE>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="description" content="">
		<meta name="author" content="">	
		<META http-equiv=Content-Type content="text/html;" charset=windows-1252>
		<meta name=GENERATOR content=ELSoft>
		<style type=text/css>
			 <!--.cp {  font: bold 10px Arial; color: black}
			 <!--.cp2 {  font: bold 9px Arial; color: black}
			 <!--.ti {  font: 9px Arial, Helvetica, sans-serif}
			 <!--.ld { font: bold 14px Arial; color: #000000}
			 <!--.ct { FONT: 9px "Arial Narrow"; COLOR: #000033}
			 <!--.cn { FONT: 9px Arial; COLOR: black }
			 <!--.bc { font: bold 22px Arial; color: #000000 }
			 .style8 {FONT: 9px Arial; COLOR: black; font-size: 14px; }
			 .style7 {FONT: 9px Arial; COLOR: black; font-size: 12px; }
			 -->
    </style>
    <meta NAME="keywords" CONTENT="">
    </head>

    <BODY text=#000000 bgColor=#ffffff topMargin=0 rightMargin=0 MARGINWIDTH=0 MARGINHEIGHT=0>

        <table width=666 cellspacing=0 cellpadding=0 border=0><tr><td valign=top class=cp><DIV ALIGN="CENTER">Instrucoes
                        de Impressao</DIV></TD></TR><TR><TD valign=top class=ti><DIV ALIGN="CENTER">Imprimir
                        em impressora jato de tinta (ink jet) ou laser em qualidade normal. (Nao use modo
                        economico). <BR>Utilize folha A4 (210 x 297 mm) ou Carta (216 x 279 mm) - Corte
                        na linha indicada<BR></DIV></td></tr></table>
        <table width="666" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <th scope="col"><div align="left">
                <table width="163" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <th width="77" scope="col"><a href="javascript:doprint();"><img src="imagens/xp49.jpg" alt="Imprimir" width="32" height="32" border="0"></a></th>
                        <th width="86" scope="col">&nbsp;</th>
                    </tr>
                </table> 
                <table width="163"  border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <th width="48%" height="19" scope="col"><div align="left" class="ct">
                        <div align="center" class="cp">Imprimir</div>
                    </div></th>
                    <th width="52%" scope="col"><div align="left" class="cp">
                        <div align="center"></div>
                    </div></th>
                    </tr>
                </table>
            </div></th>
    </tr>
</table>
<br><table cellspacing=0 cellpadding=0 width=666 border=0><TBODY><TR><TD class=ct width=666><img height=1 src=imagens/6.gif width=665 border=0></TD></TR><TR><TD class=ct width=666><div align=right><b class=cp>Recibo
                        do Sacado</b></div></TD></tr></tbody></table><table width=666 cellspacing=5 cellpadding=0 border=0><tr><td width=41></TD></tr></table>
<BR>
<table cellspacing=0 cellpadding=0 width=666 border=0>
    <tbody><tr><td class=cp width=150><img src=imagem/logo-caixa.jpg border=0 WIDTH="150" HEIGHT="40"></td>
            <td width=3 valign=bottom><img height=22 src=imagens/3.gif width=2 border=0></td><td class=cpt  width=61 valign=bottom><div align=center><font class=bc><?php echo $nrobanco; ?></font></div></td><td width=3 valign=bottom><img height=22 src=imagens/3.gif width=2 border=0></td>
            <td class=ld align=right width=450 valign=bottom><span class=ld><?php echo $linha; ?>&nbsp;</span></td>
        </tr><tr><td colspan=5><img height=2 src=imagens/2.gif width=666 border=0></td></tr></tbody></table><table width="666" border=0 cellpadding=0 cellspacing=0>
    <tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=298 height=13>Cedente</td><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=126 height=13>Agencia/Codigo
                do Cedente</td><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=34 height=13>Especie</td><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=53 height=13>Quantidade</td><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=120 height=13>Nosso
                numero</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td>
            <td class=cp2 valign=top width=298 height=12>
                <?php echo $nome_primeiro_cedente; ?></td>
            <td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td>
            <td class=cp valign=top width=126 height=12><?php echo $codigo_cedente; ?>
            </td>
            <td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td>
            <td class=cp valign=top  width=34 height=12>R$
            </td>
            <td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top  width=53 height=12>
            </td><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top align=right width=120 height=12>
                <?php echo $nossonum; ?> </td></tr><tr><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=298 height=1><img height=1 src=imagens/2.gif width=298 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=126 height=1><img height=1 src=imagens/2.gif width=126 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=34 height=1><img height=1 src=imagens/2.gif width=34 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=53 height=1><img height=1 src=imagens/2.gif width=53 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=120 height=1><img height=1 src=imagens/2.gif width=120 border=0></td></tr></tbody></table><table width="666" border=0 cellpadding=0 cellspacing=0>
    <tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top colspan=3 height=13>Numero do documento</td><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td>
            <td class=ct valign=top width=132 height=13>Data Documento </td>
            <td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=134 height=13>Vencimento</td><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=180 height=13>Valor
                documento</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top colspan=3 height=12>
                <?php echo $numdoc; ?> </td><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td>
            <td class=cp valign=top width=132 height=12><?php echo $data_doc; ?>&nbsp;
            </td>
            <td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top width=134 height=12>
                <?php echo $dataven; ?> </td><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td>
            <td class=cp valign=top align=right width=180 height=12><?php echo $doc; ?>&nbsp;
            </td>
        </tr><tr><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=113 height=1><img height=1 src=imagens/2.gif width=113 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=72 height=1><img height=1 src=imagens/2.gif width=72 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=132 height=1><img height=1 src=imagens/2.gif width=132 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=134 height=1><img height=1 src=imagens/2.gif width=134 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=imagens/2.gif width=180 border=0></td></tr></tbody></table><table width="660" border=0 cellpadding=0 cellspacing=0>
    <tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=113 height=13>(-)
                Desconto / Abatimentos</td><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=112 height=13>(-)
                Outras deducoes</td><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=113 height=13>(+)
                Mora / Multa</td><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=113 height=13>(+)
                Outros acrescimos</td><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=180 height=13>(=)
                Valor cobrado</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top align=right width=113 height=12></td><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top align=right width=112 height=12></td><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top align=right width=113 height=12><?php echo $multa; ?></td><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top align=right width=113 height=12></td><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top align=right width=180 height=12><?php echo $cob; ?></td></tr><tr><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=113 height=1><img height=1 src=imagens/2.gif width=113 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=112 height=1><img height=1 src=imagens/2.gif width=112 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=113 height=1><img height=1 src=imagens/2.gif width=113 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=113 height=1><img height=1 src=imagens/2.gif width=113 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=imagens/2.gif width=180 border=0></td></tr></tbody></table><table width="666" border=0 cellpadding=0 cellspacing=0>
    <tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td>
            <td class=ct valign=top width=659 height=13><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <th width="73%" align="left" class="ct" scope="col">Sacado</th>
                        <th width="27%" align="left" class="ct" scope="col">CPF / CNPJ do Sacado </th>
                    </tr>
                </table></td>
        </tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top width=666 height=12>
                <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <th scope="col"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <th width="73%" align="left" class="cp" scope="col"><?php echo $nome; ?>&nbsp;</th>
                            <th width="27%" align="left" class="cp" scope="col"><?php echo $ncadastro; ?>&nbsp;</th>
                        </tr>
                    </table></th>
        </tr>
        <tr>
            <td class="cp"><?php echo $end_bairro; ?>&nbsp;</td>
        </tr>
        <tr>
            <td class="cp"><?php echo $cid_est; ?>&nbsp;</td>
        </tr>
</table>
<p></p>
</td></tr><tr><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=659 height=1><img height=1 src=imagens/2.gif width=659 border=0></td></tr></tbody></table><table width="666" border=0 cellpadding=0 cellspacing=0>
    <tbody><tr><td class=ct  width=7 height=12></td>
            <td class=ct  width=564 >Instrucoes(Texto de responsabilidade do Cedente)<?php echo VER; ?></td>
            <td class=ct  width=7 height=12></td><td class=ct  width=88 >Autenticacao
                mecanica</td></tr><tr><td  width=7 ></td><td  width=564 ></td><td  width=7 ></td><td  width=88 ></td></tr></tbody></table><table cellspacing=0 cellpadding=0 width=666 border=0>
    <tbody><tr><td width=7></td><td  width=397 class=cp><table width="99%"  border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <th class="cp" scope="col">  <?=$referencia?> <?=$nfunc?> </th>
                    </tr>
                    <tr>
                        <td align="center" class="cp"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td><span class=style7><?php echo $men1; ?></span></td>
                                </tr>
                                <tr>
                                    <td><span class=style7></span></td>
                                </tr>
                                <tr>
                                    <td><span class=style7></span></td>
                                </tr>
                            </table></td>
                    </tr>
                    <tr>
                        <td align="center" class="cp"> </td>
                    </tr>
                </table>  </td>
            <td width=262></td></tr></tbody></table><table cellspacing=0 cellpadding=0 width=666 border=0>
    <tr><td class=ct width=666></td></tr><tbody><tr><td class=ct width=666>
                <div align=right>Corte na linha pontilhada</div></td></tr><tr><td class=ct width=666><img height=1 src=imagens/6.gif width=665 border=0></td></tr></tbody></table><br><br><table cellspacing=0 cellpadding=0 width=666 border=0>
    <tbody><tr><td class=cp width=150><img src=imagem/logo-caixa.jpg border=0 WIDTH="150" HEIGHT="40"></td>
            <td width=3 valign=bottom><img height=22 src=imagens/3.gif width=2 border=0></td><td class=cpt  width=64 valign=bottom><div align=center><font class=bc><?php echo $nrobanco; ?></font></div></td><td width=3 valign=bottom><img height=22 src=imagens/3.gif width=2 border=0></td>
            <td width=450 align=right valign=bottom class=ld><?php echo $linha; ?>&nbsp;</td>
        </tr><tr><td colspan=5><img height=2 src=imagens/2.gif width=666 border=0></td></tr></tbody></table>
<table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=472 height=13>Local
                de pagamento</td><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=180 height=13>Vencimento</td></tr><tr><td class=cp valign=top width=7 height=12><img height=13 src=imagens/1.gif width=1 border=0></td>
            <td class=cp valign=top width=472 height=12><?php echo $localpagamento; ?></td>
            <td class=cp valign=top width=7 height=12><img height=13 src=imagens/1.gif width=1 border=0></td><td class=cp valign=bottom align=right width=180 height=12>
                <?php echo $dataven; ?> </td></tr><tr><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=472 height=1><img height=1 src=imagens/2.gif width=472 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=imagens/2.gif width=180 border=0></td></tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=472 height=13>Cedente</td><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=180 height=13>Agencia/Codigo
                cedente</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td>
            <td class=cp valign=top width=472 height=12><?php echo $nome_segundo_cedente; ?> </td>
            <td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td>
            <td class=cp valign=top align=right width=180 height=12><?php echo $codigo_cedente; ?>
            </td>
        </tr><tr><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=472 height=1><img height=1 src=imagens/2.gif width=472 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=imagens/2.gif width=180 border=0></td></tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13>
                <img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=113 height=13>Data
                do documento</td><td class=ct valign=top width=7 height=13> <img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=163 height=13>N<u>o</u>
    documento</td><td class=ct valign=top width=7 height=13> <img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=62 height=13>Especie
    doc.</td><td class=ct valign=top width=7 height=13> <img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=34 height=13>Aceite</td><td class=ct valign=top width=7 height=13>
    <img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=72 height=13>
    processamento</td><td class=ct valign=top width=7 height=13> <img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=180 height=13>Nosso
    numero</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top  width=113 height=12><div align=left>
            <?php echo $data_doc; ?> </div></td><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top width=163 height=12>
        <?php echo $numdoc; ?> </td><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top  width=62 height=12><div align=left>OU</div></td><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top  width=34 height=12><div align=left>N
        </div></td><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top  width=72 height=12><div align=left>
            <?php echo $data_doc; ?> </div></td><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top align=right width=180 height=12>
        <?php echo $nossonum; ?> </td></tr><tr><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=113 height=1><img height=1 src=imagens/2.gif width=113 border=0></td><td valign=top width=7 height=1>
        <img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=163 height=1><img height=1 src=imagens/2.gif width=163 border=0></td><td valign=top width=7 height=1>
        <img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=62 height=1><img height=1 src=imagens/2.gif width=62 border=0></td><td valign=top width=7 height=1>
        <img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=34 height=1><img height=1 src=imagens/2.gif width=34 border=0></td><td valign=top width=7 height=1>
        <img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=72 height=1><img height=1 src=imagens/2.gif width=72 border=0></td><td valign=top width=7 height=1>
        <img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=180 height=1>
        <img height=1 src=imagens/2.gif width=180 border=0></td></tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr>
            <td class=ct valign=top width=7 height=13> <img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top COLSPAN="3" height=13>Uso
                do banco</td><td class=ct valign=top height=13 width=7> <img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=83 height=13>Carteira</td><td class=ct valign=top height=13 width=7>
                <img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=53 height=13>Especie</td><td class=ct valign=top height=13 width=7>
                <img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=123 height=13>Quantidade</td><td class=ct valign=top height=13 width=7>
                <img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=72 height=13>
                Valor Documento</td><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=180 height=13>(=)
                Valor documento</td></tr><tr> <td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td valign=top class=cp height=12 COLSPAN="3"><div align=left>
                </div></td><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top  width=83>
                <div align=left> <?php echo $descricao_carteira; ?> </div></td><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top  width=53><div align=left>R$
                </div></td><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top  width=123>
            </td><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top  width=72>&nbsp;
            </td>
            <td class=cp valign=top width=7 height=12> <img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top align=right width=180 height=12><?php echo $doc; ?>&nbsp;
            </td>
        </tr><tr><td valign=top width=7 height=1> <img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=75 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=31 height=1><img height=1 src=imagens/2.gif width=31 border=0></td><td valign=top width=7 height=1>
                <img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=83 height=1><img height=1 src=imagens/2.gif width=83 border=0></td><td valign=top width=7 height=1>
                <img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=53 height=1><img height=1 src=imagens/2.gif width=53 border=0></td><td valign=top width=7 height=1>
                <img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=123 height=1><img height=1 src=imagens/2.gif width=123 border=0></td><td valign=top width=7 height=1>
                <img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=72 height=1><img height=1 src=imagens/2.gif width=72 border=0></td><td valign=top width=7 height=1>
                <img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=imagens/2.gif width=180 border=0></td></tr></tbody>
</table><table cellspacing=0 cellpadding=0 width=666 border=0><tbody><tr><td align=right width=10><table cellspacing=0 cellpadding=0 border=0 align=left><tbody>
                        <tr> <td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td></tr><tr>
                            <td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td></tr><tr>
                            <td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=1 border=0></td></tr></tbody></table></td><td valign=top width=468 rowspan=5><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <th align="left" class="ct" scope="col">Instru&ccedil;&atilde;o (Texto de responsabilidade do Cedente) </th>
                    </tr>
                </table>
                <p align="center">      <span class=style8> <?=$referencia?> <?=$nfunc?> </span></p>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td><span class=style7><?php echo $men1; ?></span></td>
                    </tr>
                    <tr>
                        <td><span class=style7></span></td>
                    </tr>
                    <tr>
                        <td><span class=style7></span></td>
                    </tr>
                </table>
                <p align="left"></p></td><td align=right width=188><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=180 height=13>(-)
                                Desconto / Abatimentos</td></tr><tr> <td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top align=right width=180 height=12></td></tr><tr>
                            <td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=imagens/2.gif width=180 border=0></td></tr></tbody></table></td></tr>
        <tr><td align=right width=10>
                <table cellspacing=0 cellpadding=0 border=0 align=left><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td></tr><tr><td valign=top width=7 height=1>
                                <img height=1 src=imagens/2.gif width=1 border=0></td></tr></tbody></table></td><td align=right width=188><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=180 height=13>(-)
                                Outras deducoes</td></tr><tr><td class=cp valign=top width=7 height=12> <img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top align=right width=180 height=12></td></tr><tr><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=imagens/2.gif width=180 border=0></td></tr></tbody></table></td></tr><tr><td align=right width=10>
                <table cellspacing=0 cellpadding=0 border=0 align=left><tbody><tr><td class=ct valign=top width=7 height=13>
                                <img height=13 src=imagens/1.gif width=1 border=0></td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td></tr><tr><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=1 border=0></td></tr></tbody></table></td><td align=right width=188>
                <table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=180 height=13>(+)
                                Mora / Multa</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top align=right width=180 height=12><?php echo $multa; ?></td></tr><tr>
                            <td valign=top width=7 height=1> <img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=180 height=1>
                                <img height=1 src=imagens/2.gif width=180 border=0></td></tr></tbody></table></td></tr><tr><td align=right width=10><table cellspacing=0 cellpadding=0 border=0 align=left><tbody><tr>
                            <td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td></tr><tr><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=1 border=0></td></tr></tbody></table></td><td align=right width=188>
                <table cellspacing=0 cellpadding=0 border=0><tbody><tr> <td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=180 height=13>(+)
                                Outros acrescimos</td></tr><tr> <td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top align=right width=180 height=12></td></tr><tr><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=imagens/2.gif width=180 border=0></td></tr></tbody></table></td></tr><tr><td align=right width=10><table cellspacing=0 cellpadding=0 border=0 align=left><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td></tr></tbody></table></td><td align=right width=188><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=180 height=13>(=)
                                Valor cobrado</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top align=right width=180 height=12><?php echo $cob; ?></td></tr></tbody>
                </table></td></tr></tbody></table>
<table cellspacing=0 cellpadding=0 width=666 border=0><tbody><tr><td valign=top width=666 height=1><img height=1 src=imagens/2.gif width=666 border=0></td></tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td>
            <td class=ct valign=top width=659 height=13><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <th width="73%" align="left" class="ct" scope="col">Sacado </th>
                        <th width="27%" align="left" class="ct" scope="col">CPF / CNPJ do Sacado </th>
                    </tr>
                </table></td>
        </tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top width=659 height=12>
                <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <th width="73%" align="left" valign="top" class="cp" scope="col"><?php echo $nome; ?></th>
                        <th width="27%" align="left" valign="top" class="cp" scope="col"><?php echo $ncadastro; ?></th>
                    </tr>
                </table> </td>
        </tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=cp valign=top width=7 height=12><img height=12 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top width=659 height=12>
                <?php echo $end_bairro; ?></td></tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=cp valign=top width=472 height=13>
                <?php echo $cid_est; ?></td><td class=ct valign=top width=7 height=13><img height=13 src=imagens/1.gif width=1 border=0></td><td class=ct valign=top width=180 height=13>Cod.
                baixa</td></tr><tr><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=472 height=1><img height=1 src=imagens/2.gif width=472 border=0></td><td valign=top width=7 height=1><img height=1 src=imagens/2.gif width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=imagens/2.gif width=180 border=0></td></tr></tbody></table><TABLE cellSpacing=0 cellPadding=0 border=0 width=666><TBODY><TR><TD class=ct  width=7 height=12></TD><TD class=ct  width=409 >&nbsp;</TD>
            <TD class=ct  width=250 ><div align=right>Autenticacao
                    mecanica - <b class=cp>Ficha de Compensacao</b></div></TD></TR><TR><TD class=ct  colspan=3 ></TD></tr></tbody></table><TABLE cellSpacing=0 cellPadding=0 width=666 border=0><TBODY><TR>
            <TD width="666" height=50 align=left vAlign=bottom><?php
                $fp = "imagem/fp.gif";
                $fb = "imagem/fb.gif";
                $lp = "imagem/lp.gif";
                $lb = "imagem/lb.gif";

                echo "<img src=" . $fp . ">";
                echo "<img src=" . $fb . ">";
                echo "<img src=" . $fp . ">";
                echo "<img src=" . $fb . ">";

                $v0 = "00110";
                $v1 = "10001";
                $v2 = "01001";
                $v3 = "11000";
                $v4 = "00101";
                $v5 = "10100";
                $v6 = "01100";
                $v7 = "00011";
                $v8 = "10010";
                $v9 = "01010";

                $xvar = $codbarra;
                $xbarra = "";

                //Monta o entrela�amento
                $pri = true;
                for ($i = 1; $i <= strlen($xvar); $i++) {
                    if ($pri == true) {
                        $pri = false;
                        $xpri = substr($xvar, $i - 1, 1);
                        if ($xpri == '0')
                            $xpri = $v0;
                        if ($xpri == '1')
                            $xpri = $v1;
                        if ($xpri == '2')
                            $xpri = $v2;
                        if ($xpri == '3')
                            $xpri = $v3;
                        if ($xpri == '4')
                            $xpri = $v4;
                        if ($xpri == '5')
                            $xpri = $v5;
                        if ($xpri == '6')
                            $xpri = $v6;
                        if ($xpri == '7')
                            $xpri = $v7;
                        if ($xpri == '8')
                            $xpri = $v8;
                        if ($xpri == '9')
                            $xpri = $v9;
                    }else {
                        $pri = true;
                        $xseg = substr($xvar, $i - 1, 1);
                        if ($xseg == '0')
                            $xseg = $v0;
                        if ($xseg == '1')
                            $xseg = $v1;
                        if ($xseg == '2')
                            $xseg = $v2;
                        if ($xseg == '3')
                            $xseg = $v3;
                        if ($xseg == '4')
                            $xseg = $v4;
                        if ($xseg == '5')
                            $xseg = $v5;
                        if ($xseg == '6')
                            $xseg = $v6;
                        if ($xseg == '7')
                            $xseg = $v7;
                        if ($xseg == '8')
                            $xseg = $v8;
                        if ($xseg == '9')
                            $xseg = $v9;
                        //Entrela�a os dois c�digos
                        for ($j = 1; $j <= 5; $j++) {
                            $xbarra .= substr($xpri, $j - 1, 1) . substr($xseg, $j - 1, 1);
                        }
                    }
                }

                // Printa a barra
                $pri = true;
                for ($j = 1; $j <= strlen($xbarra); $j++) {
                    if ($pri) {
                        $pri = false;
                        if (substr($xbarra, $j - 1, 1) == 0)
                            $xresult = "<img src=" . $fp . ">";
                        if (substr($xbarra, $j - 1, 1) == 1)
                            $xresult = "<img src=" . $lp . ">";
                    }else {
                        $pri = true;
                        if (substr($xbarra, $j - 1, 1) == 0)
                            $xresult = "<img src=" . $fb . ">";
                        if (substr($xbarra, $j - 1, 1) == 1)
                            $xresult = "<img src=" . $lb . ">";
                    }
                    echo $xresult;
                }
                echo "<img src=" . $lp . ">";
                echo "<img src=" . $fb . ">";
                echo "<img src=" . $fp . ">";
//echo "<br>";//.$codbarra;
                ?></TD>
        </tr></tbody></table><TABLE cellSpacing=0 cellPadding=0 width=666 border=0>
    <TR><TD class=ct width=667></TD></TR><TBODY><TR><TD class=ct width=667><div align=right>Corte
                    na linha pontilhada</div></TD></TR><TR><TD class=ct width=667><img height=1 src=imagens/6.gif width=665 border=0></TD></tr></tbody></table>
</BODY></HTML>
<?php 
	// $html = ob_get_contents();
	// ob_end_clean();
	
 
	// //$html = utf8_encode($html);
	// // converte o conteudo para uft-8
 
	// define('MPDF_PATH', './mpdf/');
	// include(MPDF_PATH.'mpdf.php');
 
	// $mpdf = new mPDF('pt','A4',2,'',8,8,5,14,9,9,'P');
	// // cria o objeto
 
	// $mpdf->allow_charset_conversion=true;
	// // permite a conversao (opcional)
	// $mpdf->charset_in='UTF-8';
	// // converte todo o PDF para utf-8
	
	// //Algumas configurações do PDF
	// $mpdf->SetDisplayMode('fullpage');
	
	// $mpdf->WriteHTML($html);
	// // escreve definitivamente o conteudo no PDF
 
	// $mpdf->Output();
	// // imprime
 
	// exit();
	// // finaliza o codigo 
?>