Boa tarde
Dentro de uma aplicação blank fiz o seguinte
$h_cpf   = [cpf_usuario];
$h_mes   = [mes_escolhido];
$h_local = [local_escolhido];
?>
<?
ini_set('session.bug_compat_warn', 0);
ini_set('session.bug_compat_42', 0);
?>
<?php
$hostname_connExibirDados = "localhost";
$database_connExibirDados = "database";
$username_connExibirDados = "username";
$password_connExibirDados = "password";
$connExibirDados = mysql_pconnect($hostname_connExibirDados, $username_connExibirDados, $password_connExibirDados) or die(mysql_error());
// CADASTRO / LANÇAMENTOS
mysql_select_db($database_connExibirDados, $connExibirDados);
$query_rsLancamentos = "SELECT * FROM holl_cadastro, holl_lancamentos
                                           WHERE (holl_cadastro.cpf = '$h_cpf'
                                           AND holl_cadastro.local = '$h_local')
                                           AND (holl_lancamentos.cpf = '$h_cpf'
                                           AND  holl_lancamentos.mes_referente = '$h_mes'
                                           AND  holl_lancamentos.local = '$h_local')
                                           ORDER BY holl_lancamentos.codigo DESC";
$rsLancamentos = mysql_query($query_rsLancamentos, $connExibirDados) or die(mysql_error());
$row_rsLancamentos = mysql_fetch_assoc($rsLancamentos);
$totalRows_rsLancamentos = mysql_num_rows($rsLancamentos);
// LANÇAMENTOS - CRÉDITO
mysql_select_db($database_connExibirDados, $connExibirDados);
$query_rsLancamentos_C = "SELECT * FROM holl_cadastro, holl_lancamentos
                                              WHERE (holl_cadastro.cpf = '$h_cpf' and holl_cadastro.local = '$h_local')
                                              AND (holl_lancamentos.cpf = '$h_cpf'
                                              AND  holl_lancamentos.mes_referente = '$h_mes'
                                              AND  holl_lancamentos.local = '$h_local'
											  AND  holl_lancamentos.controle_dc = 'C')
											  ORDER BY holl_lancamentos.codigo DESC";
$rsLancamentos_C = mysql_query($query_rsLancamentos_C, $connExibirDados) or die(mysql_error());
$row_rsLancamentos_C = mysql_fetch_assoc($rsLancamentos_C);
$totalRows_rsLancamentos_C = mysql_num_rows($rsLancamentos_C);
// LANÇAMENTOS - DÉBITO
mysql_select_db($database_connExibirDados, $connExibirDados);
$query_rsLancamentos_D = "SELECT * FROM holl_cadastro, holl_lancamentos
                                              WHERE (holl_cadastro.cpf = '$h_cpf'
                                              AND holl_cadastro.local = '$h_local')
                                              AND (holl_lancamentos.cpf = '$h_cpf'
                                              AND  holl_lancamentos.mes_referente = '$h_mes'
                                              AND  holl_lancamentos.local = '$h_local'
											  AND  holl_lancamentos.controle_dc = 'D')
											  ORDER BY holl_lancamentos.codigo ASC";
$rsLancamentos_D = mysql_query($query_rsLancamentos_D, $connExibirDados) or die(mysql_error());
$row_rsLancamentos_D = mysql_fetch_assoc($rsLancamentos_D);
$totalRows_rsLancamentos_D = mysql_num_rows($rsLancamentos_D);
// TOTAL - CRÉDITO
mysql_select_db($database_connExibirDados, $connExibirDados);
$query_rsTotalCREDITO = "SELECT SUM(holl_lancamentos.VALOR) as valor_c FROM holl_cadastro, holl_lancamentos
                                WHERE (holl_cadastro.cpf = '$h_cpf'
                                AND holl_cadastro.local = '$h_local')
								AND (holl_lancamentos.cpf = '$h_cpf'
								AND  holl_lancamentos.mes_referente = '$h_mes'
								AND  holl_lancamentos.local = '$h_local'
								AND  holl_lancamentos.controle_dc = 'C') ";
$rsTotalCREDITO = mysql_query($query_rsTotalCREDITO, $connExibirDados) or die(mysql_error());
$row_rsTotalCREDITO = mysql_fetch_assoc($rsTotalCREDITO);
$totalRows_rsTotalCREDITO = mysql_num_rows($rsTotalCREDITO);
// TOTAL - DÉBITO
mysql_select_db($database_connExibirDados, $connExibirDados);
$query_rsTotalDEBITO = "SELECT SUM(holl_lancamentos.VALOR) as valor_d FROM holl_cadastro, holl_lancamentos
                                WHERE (holl_cadastro.cpf = '$h_cpf'
                                AND holl_cadastro.local = '$h_local')
								AND (holl_lancamentos.cpf = '$h_cpf'
								AND  holl_lancamentos.mes_referente = '$h_mes'
								AND  holl_lancamentos.local = '$h_local'
								AND  holl_lancamentos.controle_dc = 'D') ";
$rsTotalDEBITO = mysql_query($query_rsTotalDEBITO, $connExibirDados) or die(mysql_error());
$row_rsTotalDEBITO = mysql_fetch_assoc($rsTotalDEBITO);
$totalRows_rsTotalDEBITO = mysql_num_rows($rsTotalDEBITO);
$totalLIQUIDO = $row_rsTotalCREDITO['valor_c'] - $row_rsTotalDEBITO['valor_d'];
?>
I.P.A.S.P. - Emissão de hollerits
form {
display: inline;
}
.style1 {
	font-size: 10px;
	font-weight: bold;
}
.style2 {font-size: 10px}
.pontilhado{
border-style: dotted;
border-width: 1px;
border-color: 660033;
font-family: verdana, arial;
font-size: 10pt;
}
body {
	background-image: url();
}
	
	
	
html, body {height:100%;} 
body {
	margin:0; 
	padding:0;
	text-align:center;
	}
* html #tudo {height: 100%;}
* {
	margin: 0;
	font-family: Verdana, Geneva, sans-serif;
	font-size: 10px;
	color: #000000;
	}
#rodape {
	width: 100%;
	background-repeat: repeat-x;
	height: 50px;
	position: absolute;
	bottom: 0;
	text-align: center;
}
/* Classes */
.texto {
	margin-left: 0;
	font-family: Verdana, Geneva, sans-serif;
	font-size: 11px;
	text-align: left;
}
.textorodape {
	padding-top: 15px;
	font-size: 12px;
}
.clear { 
	clear: both;
}
<?
 function ConverteData($Data){
   if (strstr($Data, "/"))//verifica se tem a barra /
      {
      $d = explode ("/", $Data);//tira a barra
      $rstData = "$d[2]-$d[1]-$d[0]";//separa as datas $d[2] = ano $d[1] = mes etc...
      return $rstData;
   } elseif(strstr($Data, "-")){
     $d = explode ("-", $Data);
     $rstData = "$d[2]/$d[1]/$d[0]";
     return $rstData;
     }else{
     return "";
   }
 }
?>
  
     | 
  
  
    
  
    
      
        
          <?php echo ltrim(utf8_encode($row_rsLancamentos['nome'])); ?> 
          <?php echo ltrim(utf8_encode($row_rsLancamentos['endereco'])); ?> | 
      MÊS
        REFERÊNCIA  | 
      DATA
        DO PAGAMENTO  | 
       
    
      <?php echo $row_rsLancamentos['mes_referente']; ?>  | 
      <?php echo ConverteData($row_rsLancamentos['data_pagamento_final']); ?>  | 
       
   
 | 
  
  
    
      
        | Local de trabalho | 
        Referência  | 
        C.P.F.  | 
        Identificação  | 
        Banco  | 
        Agência  | 
        Conta corrente  | 
        Cargo  | 
       
      
        |  <?php echo $row_rsLancamentos['local']; ?> | 
        <?php echo $row_rsLancamentos['referencia']; ?>  | 
        <?php echo $row_rsLancamentos['cpf']; ?>  | 
        <?php echo $row_rsLancamentos['nfuncional']; ?>  | 
        <?php echo $row_rsLancamentos['banco']; ?>  | 
        <?php echo $row_rsLancamentos['agencia']; ?>  | 
        <?php echo $row_rsLancamentos['conta_corrente']; ?>  | 
        <?php echo $row_rsLancamentos['cargo']; ?>  | 
       
     
 | 
  
  
    
      
        CÓDIGO  | 
        DESCRIÇÃO DO CÓDIGO  | 
        VENCIMENTOS  | 
        DESCONTOS  | 
       
 
      
        <?php do { ?>
        
          <?php echo $row_rsLancamentos_C['codigo']; ?>  | 
          <?php echo utf8_encode($row_rsLancamentos_C['descricao_codigo']); ?> | 
          
 R$  
                <?php echo number_format($row_rsLancamentos_C['valor'],2,',','.'); ?>  
		              | 
            | 
         
        <?php } while ($row_rsLancamentos_C = mysql_fetch_assoc($rsLancamentos_C)); ?>
        <?php do { ?>
        
          <?php echo $row_rsLancamentos_D['codigo']; ?>  | 
          <?php echo utf8_encode($row_rsLancamentos_D['descricao_codigo']); ?> | 
            | 
          
  R$  <?php echo number_format($row_rsLancamentos_D['valor'],2,',','.'); ?>  
                      | 
         
        <?php } while ($row_rsLancamentos_D = mysql_fetch_assoc($rsLancamentos_D)); ?>
          | 
  
  
    | Observações | 
    TOTAL DE VENCIMENTOS  | 
    TOTAL DE DESCONTOS  | 
    TOTAL LIQUIDO  | 
  
  
    <?php echo ltrim(utf8_encode($row_rsLancamentos['mensagem'])); ?>  | 
    R$  <?php echo number_format($row_rsTotalCREDITO['valor_c'],2,',','.'); ?>  | 
    R$  <?php echo number_format($row_rsTotalDEBITO['valor_d'],2,',','.'); ?>  | 
    R$  <?php echo number_format($totalLIQUIDO,2,',','.'); ?>  | 
  
<?php
mysql_free_result($rsLancamentos);
mysql_free_result($rsLancamentos_C);
mysql_free_result($rsLancamentos_D);
mysql_free_result($rsTotalCREDITO);
mysql_free_result($rsTotalDEBITO);
?>
<?php
Ta funfando leval.
Só que eu preciso gerar um pdf desse mesmo relatorio e salvar em uma pasta para posteriormente enviar esse pdf por email.
Alguem tem uma ideia ?
Valeu