Ideia para imprimir documento
Boa noite pessoal.
Estou refazendo uma intranet e surgiu uma dúvida.
Fiz um teste com vários campos (o documento pode ter mais ou menos campos).
Estou testando imprimir via javascript (window.print()) e pelo FPDF.
Em ambos os casos, me deparei com essa característica (na imagem).
A parte da assinatura dos responsáveis corta ao meio.
Alguém já se deparou com algo parecido?
Seria possível, na impressão, não quebrar as assinaturas?
Obrigado!
Segue o código atual (versão não FPDF)
<?php
/******* Conexão com o bando de dados *******/
include "Conexao/config.php";
mysqli_select_db($config, $database_config);
mysqli_set_charset($config,"utf8");
/******* Conexão com o bando de dados *******/
$info = "Não há itens cadastrados no momento";
$erro = "Erro ao acessar dados";
include "php/restrict.php";
$id_item = $array_pgn[5];
$sql_2 = mysqli_query($config, "SELECT ma.titulo, ma.datadecadastro, usr.nome, usr.id_estabelecimento, ma.datadecadastro, ma.protocolo, ma.id_usuario_envio, ma.datadeenvio, ma.id_transportadora, ma.id_usuario_recebimento, ma.dataderecebimento, ma.datadefechamento, ma.id_estabelecimento_destino, ma.id_estabelecimento_origem, ma.id_usuario_cadastro FROM malote ma LEFT JOIN usuario AS usr ON (ma.id_usuario_cadastro = usr.id) WHERE ma.id = '$id_item'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_2) <= '0'){
echo "
<div class=\"row\">
<div class=\"col-lg-6\">
<div class=\"alert alert-danger\">
<strong>Erro!</strong> $erro
</div>
</div>
</div>
";
}else{
while($r_sql_2 = mysqli_fetch_array($sql_2)){
$titulo = $r_sql_2[0];
$datadecadastro = date("d/m/Y", strtotime($r_sql_2[1]));
$nome_usuario_cadastro = $r_sql_2[2];
$id_usuario_estabalecimento = $r_sql_2[3];
$datadecadastro_malote = date("d/m/Y", strtotime($r_sql_2[4]));
$hora_datadecadastro_malote = date("H:i", strtotime($r_sql_2[4]));
$protocolo = $r_sql_2[5];
$id_usuario_envio = $r_sql_2[6];
$datadeenvio_malote = date("d/m/Y", strtotime($r_sql_2[7]));
$hora_datadeenvio_malote = date("H:i", strtotime($r_sql_2[7]));
$id_transportadora = $r_sql_2[8];
$id_usuario_recebimento = $r_sql_2[9];
$dataderecebimento_malote_c = $r_sql_2[10];
$dataderecebimento_malote = date("d/m/Y", strtotime($r_sql_2[10]));
$hora_dataderecebimento_malote = date("H:i", strtotime($r_sql_2[10]));
$datadefechamento_malote = date("d/m/Y", strtotime($r_sql_2[11]));
$hora_datadefechamento_malote = date("H:i", strtotime($r_sql_2[11]));
$id_estabelecimento_destino = $r_sql_2[12];
$id_estabelecimento_origem = $r_sql_2[13];
$id_usuario_cadastro = $r_sql_2[14];
$sql_3_a = mysqli_query($config, "SELECT id_estabelecimento FROM usuario WHERE id = '$id_usuario_cadastro'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_3_a) <= '0'){
$estabelecimento_destino = "";
}else{
while($r_sql_3_a = mysqli_fetch_array($sql_3_a)){
$id_estabelecimento_origem_usuario = $r_sql_3_a[0];
}
}
$sql_3_b = mysqli_query($config, "SELECT titulo FROM estabelecimento WHERE id = '$id_estabelecimento_origem_usuario'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_3_b) <= '0'){
$estabelecimento_destino = "";
}else{
while($r_sql_3_b = mysqli_fetch_array($sql_3_b)){
$estabelecimento_cadastro = $r_sql_3_b[0];
}
}
/****** Origem ******/
$sql_3_c = mysqli_query($config, "SELECT titulo FROM estabelecimento WHERE id = '$id_estabelecimento_origem'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_3_c) <= '0'){
$estabelecimento_origem = "";
}else{
while($r_sql_3_c = mysqli_fetch_array($sql_3_c)){
$estabelecimento_origem = $r_sql_3_c[0];
}
}
$sql_3_d = mysqli_query($config, "SELECT titulo FROM estabelecimento WHERE id = '$id_usuario_estabalecimento'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_3_a) <= 0){
echo "";
}else{
while($r_sql_3_d = mysqli_fetch_array($sql_3_d)){
$usuario_estabalecimento_origem = $r_sql_3_d[0];
}
}
/****** Origem ******/
/****** Envio ******/
$sql_3_e = mysqli_query($config, "SELECT nome FROM usuario WHERE id = '$id_usuario_envio'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_3_e) <= 0){
echo "";
}else{
while($r_sql_3_e = mysqli_fetch_array($sql_3_e)){
$nome_usuario_envio = $r_sql_3_e[0];
}
}
$sql_3_e = mysqli_query($config, "SELECT titulo FROM transportadora WHERE id = '$id_transportadora'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_3_e) <= 0){
echo "";
}else{
while($r_sql_3_e = mysqli_fetch_array($sql_3_e)){
$transportadora = $r_sql_3_e[0];
}
}
/****** Envio ******/
/****** Recebimento ******/
$sql_3_f = mysqli_query($config, "SELECT nome FROM usuario WHERE id = '$id_usuario_recebimento'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_3_f) <= 0){
echo "";
}else{
while($r_sql_3_f = mysqli_fetch_array($sql_3_f)){
$nome_usuario_recebimento = $r_sql_3_f[0];
}
}
$sql_3_g = mysqli_query($config, "SELECT titulo FROM estabelecimento WHERE id = '$id_estabelecimento_destino'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_3_g) <= '0'){
$estabelecimento_destino = "";
}else{
while($r_sql_3_g = mysqli_fetch_array($sql_3_g)){
$estabelecimento_destino = $r_sql_3_g[0];
}
}
/****** Recebimento ******/
}
}
if(isset($_POST['voltar']) && $_POST['voltar'] == 'ok'){
header("location:http://localhost/projetos/intranet/listar-malotes");
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Properità Negócios</title>
<link href="<?php echo $dir_base; ?>fonts/OpenSans/stylesheet.css" rel="stylesheet" type="text/css" />
<link href="<?php echo $dir_base; ?>assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="<?php echo $dir_base; ?>assets/global/css/components-imprime.min.css" rel="stylesheet" id="style_components" type="text/css" />
<style type="text/css">
/* reset */
*{
border: 0;
color: inherit;
font-family: "Open Sans",sans-serif;
font-size: inherit;
font-style: inherit;
font-weight: inherit;
line-height: inherit;
list-style: none;
margin: 0;
padding: 0;
text-decoration: none;
vertical-align: top;
}
body{
margin: initial;
padding: initial;
}
/* content editable */
*[contenteditable] { min-width: 1em; outline: 0; }
*[contenteditable] { cursor: pointer; }
*[contenteditable]:hover, *[contenteditable]:focus, td:hover *[contenteditable], td:focus *[contenteditable], img.hover { background: #DEF; box-shadow: 0 0 1em 0.5em #DEF; }
span[contenteditable] { display: inline-block; }
/* heading */
h1 { text-align: center; text-transform: uppercase; }
/* table */
html { font: 16px/1 'Open Sans', sans-serif; overflow: auto; padding: 0.5in; }
html { background: #999; cursor: default; }
body { box-sizing: border-box; /* height: 11in;*/ margin: 0 auto; overflow: hidden; padding: 0.5in; /* width: 8.5in;*/ }
body { background: #FFF; box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5); }
/* header */
header { margin: 0 0 1em; }
header:after { clear: both; content: ""; display: table; }
header h1 {font-size: 26px; background: #000; color: #FFF; margin: 0 0 1em; padding: 0.5em 0; }
header address { float: left; font-size: 75%; font-style: normal; line-height: 1.25; margin: 0 1em 1em 0; }
header address p { margin: 0 0 0.25em; }
header span, header img { display: block; float: right; }
header span { margin: 0 0 1em 1em; max-height: 25%; max-width: 60%; position: relative; }
header img { max-height: 100%; max-width: 100%; }
header input { cursor: pointer; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; height: 100%; left: 0; opacity: 0; position: absolute; top: 0; width: 100%; }
/* article */
article, article address, table.meta, table.inventory { margin: 0 0 3em; }
article:after { clear: both; content: ""; display: table; }
article h1 { clip: rect(0 0 0 0); position: absolute; }
article address { float: left; font-size: 125%; font-weight: bold; }
/* table meta & balance */
table.meta, table.balance { float: right; width: 36%; }
table.meta:after, table.balance:after { clear: both; content: ""; display: table; }
/* table meta */
table.meta th { width: 40%; }
table.meta td { width: 60%; }
/* table items */
table.inventory { clear: both; width: 100%; }
table.inventory th { font-weight: bold; text-align: center; }
table.inventory td:nth-child(1) { width: 26%; }
table.inventory td:nth-child(2) { width: 38%; }
table.inventory td:nth-child(3) { text-align: right; width: 12%; }
table.inventory td:nth-child(4) { text-align: right; width: 12%; }
table.inventory td:nth-child(5) { text-align: right; width: 12%; }
/* table balance */
table.balance th, table.balance td { width: 50%; }
table.balance td { text-align: right; }
/* aside */
aside h1 { border: none; border-width: 0 0 1px; margin: 0 0 1em; }
aside h1 { border-color: #999; border-bottom-style: solid; }
/* javascript */
.add, .cut
{
border-width: 1px;
display: block;
font-size: .8rem;
padding: 0.25em 0.5em;
float: left;
text-align: center;
width: 0.6em;
}
.add, .cut
{
background: #9AF;
box-shadow: 0 1px 2px rgba(0,0,0,0.2);
background-image: -moz-linear-gradient(#00ADEE 5%, #0078A5 100%);
background-image: -webkit-linear-gradient(#00ADEE 5%, #0078A5 100%);
border-color: #0076A3;
color: #FFF;
cursor: pointer;
font-weight: bold;
text-shadow: 0 -1px 2px rgba(0,0,0,0.333);
}
.add { margin: -2.5em 0 0; }
.add:hover { background: #00ADEE; }
.cut { opacity: 0; position: absolute; top: 0; left: -1.5em; }
.cut { -webkit-transition: opacity 100ms ease-in; }
tr:hover .cut { opacity: 1; }
@media print {
* { -webkit-print-color-adjust: exact; }
html { background: none; padding: 0; }
body { box-shadow: none; margin: 0; }
span:empty, .btn.blue { display: none; }
.add, .cut { display: none; }
}
@page { margin: 0; }
.sepador_div{
border-bottom: 1px solid #000000;
}
.responsaveis{
display: block;
margin-bottom: 60px;
}
.responsavel_1{
border-top: 1px solid #000000;
padding-top: 10px;
}
.responsavel_2{
border-top: 1px solid #000000;
margin-top: 80px;
padding-top: 10px;
}
.responsaveis_div{
width: 50%;
margin: 0 auto;
}
</style>
<link rel="license" href="http://www.opensource.org/licenses/mit-license/">
</head>
<body>
<form role="form" id="form_voltar" name="form_voltar" action="" method="post" enctype="multipart/form-data" class="text-right" style="margin-bottom: 20px;">
<button type="submit" class="btn blue" tabindex="7">
<i class="fa fa-check"></i> Fechar
</button>
<input type="hidden" name="voltar" value="ok" />
</form>
<header>
<h1>Malote <?php echo $titulo; ?></h1>
<div>
<h4>Origem: <?php echo $estabelecimento_origem; ?></h4>
<p>Cadastrado por: <?php echo $nome_usuario_cadastro; ?> (<?php echo $usuario_estabalecimento_origem; ?>)</p>
<p>Data de cadastro: <?php echo $datadecadastro_malote; ?> às <?php echo $hora_datadecadastro_malote; ?></p>
<p>Protocolo: <?php echo $protocolo; ?></p>
</div>
<hr />
<div>
<p>Enviado por: <?php echo $nome_usuario_envio; ?> (<?php echo $estabelecimento_cadastro; ?>)</p>
<p>Data de envio: <?php echo $datadeenvio_malote; ?> às <?php echo $hora_datadeenvio_malote; ?></p>
<p>Transportadora: <?php echo $transportadora; ?></p>
</div>
<hr />
<div>
<h4>Destino: <?php echo $estabelecimento_destino; ?></h4>
<!-- <p>Enviado para: <?php //echo $nome_usuario_recebimento; ?></p> -->
</div>
</div>
</header>
<article>
<?php
$sql_3_aux = mysqli_query($config, "SELECT bm.fornecedor, bm.vencimento, bm.valor, bm.datadecadastro, usr.nome FROM boletosdomalote bm LEFT JOIN usuario AS usr ON (bm.id_usuario = usr.id) WHERE bm.id_malote = '$id_item'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_3_aux) > 0){
?>
<div class="portlet-body">
<h4 class="block">Boletos do malote</h4>
<table class="table table-bordered table-striped">
<thead>
<tr class="bg-default bg-font-default">
<th> Fornecedor </th>
<th> Vencimento </th>
<th> Valor </th>
<th> Data de Cadastro </th>
<th> Cadastrado Por </th>
</tr>
</thead>
<tbody>
<?php
$sql_3 = mysqli_query($config, "SELECT bm.fornecedor, bm.vencimento, bm.valor, bm.datadecadastro, usr.nome FROM boletosdomalote bm LEFT JOIN usuario AS usr ON (bm.id_usuario = usr.id) WHERE bm.id_malote = '$id_item'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_3) <= 0){
echo "";
}else{
while($r_sql_3 = mysqli_fetch_array($sql_3)){
$forcenedor_1 = $r_sql_3[0];
$vencimento_1 = date("d/m/Y", strtotime($r_sql_3[1]));
$valor_1 = "R$ " . number_format($r_sql_3[2],2, ',', '.');
$datadecadastro_1 = date("d/m/Y", strtotime($r_sql_3[3]));
$hora_datadecadastro_1 = date("H:i", strtotime($r_sql_3[3]));
$usuario_1 = $r_sql_3[4];
?>
<tr>
<td class="alinhamento_central"> <?php echo $forcenedor_1; ?> </td>
<td class="alinhamento_central"> <?php echo $vencimento_1; ?> </td>
<td class="alinhamento_central"> <?php echo $valor_1; ?> </td>
<td class="alinhamento_central"> <?php echo $datadecadastro_1 . " às " . $hora_datadecadastro_1; ?> </td>
<td class="alinhamento_central"> <?php echo $usuario_1; ?> </td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<?php
}
?>
<?php
$sql_4_aux = mysqli_query($config, "SELECT cm.pdv, cm.datadecadastro, cm.datadeemissao, usr.nome FROM caixasdomalote cm LEFT JOIN usuario AS usr ON (cm.id_usuario = usr.id) WHERE cm.id_malote = '$id_item'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_4_aux) > 0){
?>
<div class="portlet-body">
<h4 class="block">Caixas do malote</h4>
<table class="table table-bordered table-striped">
<thead>
<tr class="bg-default bg-font-default">
<th> PDV </th>
<th> Data de Emissão </th>
<th> Data de Cadastro </th>
<th> Cadastrado Por </th>
</tr>
</thead>
<tbody>
<?php
$sql_4 = mysqli_query($config, "SELECT cm.pdv, cm.datadecadastro, cm.datadeemissao, usr.nome FROM caixasdomalote cm LEFT JOIN usuario AS usr ON (cm.id_usuario = usr.id) WHERE cm.id_malote = '$id_item'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_4) <= 0){
echo "";
}else{
while($r_sql_4 = mysqli_fetch_array($sql_4)){
$pdv_2 = $r_sql_4[0];
$datadecadastro_2 = date("d/m/Y", strtotime($r_sql_4[1]));
$hora_datadecadastro_2 = date("H:i", strtotime($r_sql_4[1]));
$emissao_2 = date("d/m/Y", strtotime($r_sql_4[2]));
$usuario_2 = $r_sql_4[3];
?>
<tr>
<td class="alinhamento_central"> <?php echo $pdv_2; ?> </td>
<td class="alinhamento_central"> <?php echo $emissao_2; ?> </td>
<td class="alinhamento_central"> <?php echo $datadecadastro_2 . " às " . $hora_datadecadastro_2; ?> </td>
<td class="alinhamento_central"> <?php echo $usuario_2; ?> </td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<?php
}
?>
<?php
$sql_5_aux = mysqli_query($config, "SELECT nfm.numero, nfm.fornecedor, nfm.datadeemissao, nfm.datadecadastro, usr.nome, nfm.valor FROM notasfiscaisdomalote nfm LEFT JOIN usuario AS usr ON (nfm.id_usuario = usr.id) WHERE nfm.id_malote = '$id_item'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_5_aux) > 0){
?>
<div class="portlet-body">
<h4 class="block">Notas Fiscais do malote</h4>
<table class="table table-bordered table-striped">
<thead>
<tr class="bg-default bg-font-default">
<th> Número da nota fiscal </th>
<th> Fornecedor </th>
<th> Data de Emissão </th>
<th> Valor </th>
<th> Data de cadastro </th>
<th> Cadastrado por </th>
</tr>
</thead>
<tbody>
<?php
$sql_5 = mysqli_query($config, "SELECT nfm.numero, nfm.fornecedor, nfm.datadeemissao, nfm.datadecadastro, usr.nome, nfm.valor FROM notasfiscaisdomalote nfm LEFT JOIN usuario AS usr ON (nfm.id_usuario = usr.id) WHERE nfm.id_malote = '$id_item'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_5) <= '0'){
echo "";
}else{
while($r_sql_5 = mysqli_fetch_array($sql_5)){
$numero_3 = $r_sql_5[0];
$fornecedor_3 = $r_sql_5[1];
$emissao_3 = date("d/m/Y", strtotime($r_sql_5[2]));
$datadecadastro_3 = date("d/m/Y", strtotime($r_sql_5[3]));
$hora_datadecadastro_3 = date("H:i", strtotime($r_sql_5[3]));
$usuario_3 = $r_sql_5[4];
$valor_3 = "R$ " . number_format($r_sql_5[5],2, ',', '.');
?>
<tr>
<td class="alinhamento_central"> <?php echo $numero_3; ?> </td>
<td class="alinhamento_central"> <?php echo $fornecedor_3; ?> </td>
<td class="alinhamento_central"> <?php echo $emissao_3; ?> </td>
<td class="alinhamento_central"> <?php echo $valor_3; ?> </td>
<td class="alinhamento_central"> <?php echo $datadecadastro_3 . " às " . $hora_datadecadastro_3; ?> </td>
<td class="alinhamento_central"> <?php echo $usuario_3; ?> </td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<?php
}
?>
<?php
$sql_6_aux = mysqli_query($config, "SELECT dm.titulo, dm.datadecadastro, usr.nome FROM documentosdomalote dm LEFT JOIN usuario AS usr ON (dm.id_usuario = usr.id) WHERE dm.id_malote = '$id_item'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_6_aux) > 0){
?>
<div class="portlet-body">
<h4 class="block">Documentos do malote</h4>
<table class="table table-bordered table-striped">
<thead>
<tr class="bg-default bg-font-default">
<th> Título </th>
<th> Data de cadastro </th>
<th> Cadastrado por </th>
</tr>
</thead>
<tbody>
<?php
$sql_6 = mysqli_query($config, "SELECT dm.titulo, dm.datadecadastro, usr.nome FROM documentosdomalote dm LEFT JOIN usuario AS usr ON (dm.id_usuario = usr.id) WHERE dm.id_malote = '$id_item'") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_6) <= '0'){
echo "";
}else{
while($r_sql_6 = mysqli_fetch_array($sql_6)){
$titulo_4 = $r_sql_6[0];
$datadecadastro_4 = date("d/m/Y", strtotime($r_sql_6[1]));
$hora_datadecadastro_4 = date("H:i", strtotime($r_sql_6[1]));
$usuario_4 = $r_sql_6[2];
?>
<tr>
<td class="alinhamento_central"> <?php echo $titulo_4; ?> </td>
<td class="alinhamento_central"> <?php echo $datadecadastro_4 . " às " . $hora_datadecadastro_4; ?> </td>
<td class="alinhamento_central"> <?php echo $usuario_4; ?> </td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<?php
}
?>
</article>
<aside>
<div class="row text-center">
<div class="responsaveis_div">
<h4 class="responsaveis">Responsáveis</h4>
<div class="responsavel_1"><?php echo $nome_usuario_envio; ?> (<?php echo $estabelecimento_cadastro; ?>)</div>
<div class="responsavel_2"><?php echo $estabelecimento_destino; ?> (<?php //echo $nome_usuario_recebimento; ?>)</div>
</div>
</div>
</aside>
<script src="<?php echo $dir_base; ?>assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="<?php echo $dir_base; ?>assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
window.print();
})
</script>
</body>
</html>Discussão (0)
Carregando comentários...