$obj['ano_mes'] = mes(substr($ano_mes, 4, 2)) . "/" . substr($ano_mes, 0, 4); $obj['dt_admissao'] = dateFormat($obj['dt_admissao']); $obj['cpf'] = mask($obj['cpf'], '###.###.###-##'); $obj['pis_pasep'] = mask($obj['pis_pasep'], '###.#####.##-#'); $obj['tot_venctos'] = valorM($obj['tot_venctos']); $obj['sal_liquido'] = valorM($obj['sal_liquido']); $obj['tot_descontos'] = valorM($obj['tot_descontos']); $obj['vencto_base_cargo'] = valorM(substr($obj['vencto_base_cargo'], 0, -2)); $obj['tipo_salario'] = $obj['tipo_salario'] == 1 ? " MENSAL" : " HORA/AULA"; $obj['bc_previd'] = valorM($obj['bc_previd']); $obj['bc_irrf'] = valorM($obj['bc_irrf']); $obj['qtd_depend_irrf'] = valorM($obj['qtd_depend_irrf']); $obj['tot_deduc_depend'] = valorM($obj['tot_deduc_depend']); $obj['sal_liquido'] = valorM($obj['sal_liquido']); $obj['vencimentoV'] = vencimento("V", $cli_id, $strAnoMes, 0, $id_servidor); $obj['vencimentoD'] = vencimento("D", $cli_id, $strAnoMes, 0, $id_servidor); $tplRelatorio = file_get_contents('relatorioTpl.html'); // echo 'Obj: <pre>';print_r( $obj );die; $keys = getKeysDados($obj); // var_dump($keys);die; $values = array_values($obj); echo $header = "<!DOCTYPE html>\r\n <html>\r\n <head>\r\n <meta charset='utf-8'>\r\n <meta http-equiv='X-UA-Compatible' content='IE=edge'>\r\n <title>Modelo Contra-cheque</title>\r\n <link rel='stylesheet' type='text/css' href='relatorioStyle.css'>\r\n </head>\r\n <body>"; echo $ccheque = str_replace($keys, $values, $tplRelatorio); // echo $criptPrint = "<script language='JavaScript'>window.print();</script>"; echo $footer = "</body></html>"; // GERAR LISTA DE DESCONTOS E VALORES //parcelar=0 zero padrao segundo Gerson ou cabeludo //D denconto ou V valores function vencimento($dv, $cli_id, $ano_mes, $parcela, $id_servidor) { $dados = @Comando::Executar("Select * from evento_calc_mes\r\n where cli_id = {$cli_id}\r\n \t\t\tand ano_mes = '{$ano_mes}'\r\n \t\t\tand parcela = '{$parcela}'\r\n\t\t\tand id_servidor = {$id_servidor}\r\n\t\t\tand tipo_evento ='{$dv}'\r\n \t");
} return $lista_dados; /* <div class="leftx" style="width:8%">1</div> <div class="leftx" style="width:58%">2fgfgn</div> <div class="leftx" style="width:14%">3</div> <div class="leftx" style="width:20%">4</div> */ } $tipoval = ""; if (strcmp($obj['tipo_salario'], '1')) { $tipoval = "Mensal"; } else { $tipoval = "HORA/AULA"; } $valhtml = " <!doctype html>\n<html>\n<head>\n<meta charset='utf-8'>\n<title>Untitled Document</title>\n\n<style type='text/css'>\nbody{\n\tfont-family: 'DejaVu Sans', Arial, Helvetica, sans-serif;\n\tmargin-top:0px;\t\n\tfont-size: 9px;\n\t}\n a {text-decoration: none}\n\t.leftx{\n\tfloat:left;\n\tmargin-top:0px;\n\t\n\tcolor: #000000;\n\t\n\tmargin-top:1px;\n\tmargin-bottom:2px;\t\n\t\t}\n\t.titulo{\n\t\n\tcolor: #000000;\n\tline-height: 1.2207031;\n\tfont-weight: bold;\n\tmargin-left:3px;\n\tfont-size:10px;\n\t\n\t}\n\t.tabletopo{\n\t\n\theight:20px;\n\t\n\t}\n\t.textual{\n\t\n\tcolor: #000000;\n\tfont-weight: bold;\n\t\n\t}\n\t.textotal{\n\t\n\tcolor: #000000;\n\tfont-weight: bold;\n\t\n\t\n\t}\n\t.vintq{\n\twidth:32%;\n\tfloat:left;\n\tdisplay: block;\n\tfont-weight: bold;\n\tmargin-left:10px;\t\n\t\t}\n\t.trinq{\n\twidth:16%;\n\tfloat:left;\n\tdisplay: block;\n\tfont-weight: bold;\t\n\tmargin-top:10px;\n\tmargin-left:5px;\n\t\t}\t\n\t\t\n\t.vint15{\n\twidth:15%;\n\tfloat:left;\n\tdisplay: block;\n\tfont-weight: bold;\t\n\t\t}\t\n\t\t\n\t.cinq{\n\twidth:48%;\n\tfloat:left;\t\n\t\n\tfont-weight: bold;\n\tmargin-top:10px;\n\tmargin-left:5px;\n\t\t}\n\t\t.cinx{\n\twidth:49%;\n\tfloat:left;\t\n\t\n\tfont-weight: bold;\n\t\n\t\t}\n\t\t\n\t.quar{\n\twidth:40%;\n\tfloat:left;\t\n\tfont-weight: bold;\n\t/*margin-top:12px;*/\n\theight:20px;\n\tmargin-left:10%;\n\t\t}\n\t.dez{\n\twidth:10%;\n\tfloat:left;\t\n\t\n\tfont-weight: bold;\n\t/*margin-top:12px;*/\n\theight:20px;\n\t}\n\t.container{\n\talignment-adjust:auto;\n\twidth:80%;\n\tmargin-left:10%;\n\t\t\n\t\t}\n\t\tdiv{ \nborder:1px #333 solid; \n} \t\n\t.table2{\n\t\theight:10px;\n\t\t}\n\t\t\n </style>\n</head>\n\n<body class='container' >\n\n<table width='100%' border='1' bordercolor='#999999' class='tabletopo'>\n <tr>\n <td width='21%' align='center'>\n\t<img src='logo_para.jpg'>\n\t\n\t</td>\n <td width='79%'>\n <p align='right' style='font-size:7px; margin-right:10px' >DEMONSTRATIVO DE PAGAMENTO DE SALÁRIO (CONTRA-CHEQUE)</p>\n <p class='titulo'>" . $obj['razao_social_ug'] . "</p>\n <p class='titulo'>" . $obj['ender_lograd_ug'] . "Nº " . $obj['ender_num_ug'] . ", " . $obj['ender_bairro_ug'] . "</p>\n <p class='titulo'>" . $obj['ender_cidade'] . ' - CEP:' . $obj['ender_cep'] . ' - ' . $obj['ender_uf'] . "</p>\n\n<p class='titulo' align='left' style='float:left; width:40%'>\n CNPJ:" . $obj['cnpj_ug'] . "\n </p>\n \n <p align='right' style='width:40%; float:right; margin-right:5px;'>\n\t" . "" . "</div>\n\t\n\n\t\n </td>\n </tr>\n</table>\n\n\n\n\n<table width='100%' border='0'>\n <tr>\n <td width='16%'>Mátricula<br>\n " . $obj['id_servidor'] . "\n </td>\n <td width='33%'>Nome do Servidor<br>\n " . $obj['nome'] . "\n </td>\n <td width='20%'>Admissão<br>\n " . $obj['dt_admissao'] . "\n </td>\n <td width='31%'>Cargo/Função<br>\n " . $obj['descr_cargo'] . "\n </td>\n </tr>\n</table>\n<table width='100%' border='0'>\n <tr>\n <td width='49%'>Sub-Unida. Orçamentária (Centro de Custos) <br>\n " . $obj['id_sub_und_orcam'] . ' - ' . $obj['descr_sub_unid_orcan'] . "\n </td>\n <td width='51%'>Unida. de Lotacao (Local de Trabalho )<br>\n " . $obj['descr_unid_lotac'] . "\n </td>\n </tr>\n</table>\n\n<table width='100%' border='0'>\n <tr>\n <td width='49%'>\n " . $obj['descr_situac_tcm'] . "\n <br>\n " . $obj['descr_est_funcional'] . "\n </td>\n <td width='16%'>C.P.F.<br>\n " . $obj['cpf'] . "\n </td>\n <td width='17%'>identidade<br>\n " . $obj['rg'] . "\n </td>\n <td width='18%'>PIS/PASEP<br>\n " . $obj['pis_pasep'] . "\n </td>\n </tr>\n</table>\n\n<p> </p>\n\n<div>\n\n<table width='100%' border='1' align='center'>\n <tr align='center'>\n <td>VENCIMENTOS / PROVENTOS</td>\n <td>VENCIMENTOS / PROVENTOS</td>\n </tr>\n</table>\n\n<table width='100%' border='0' style='font-size:8px;'>\n <tr>\n <td width='4%'>Cód</td>\n <td width='28%'> </td>\n <td width='7%'>Quant.</td>\n <td width='10%'>Valor (R\$)</td>\n <td width='3%'> </td>\n <td width='4%'>Cód</td>\n <td width='27%'> </td>\n <td width='7%'>Quant.</td>\n <td width='10%'>Valor (R\$)</td>\n </tr>\n</table>\n\n</table>\n<table width='100%' border='0' style='font-size:7px;'>\n <tr>\n <td width='49%'>\n\t<table width='100%' border='0'>\n " . vencimento('V', $cli_id, $ano_mes, $parcela, $id_servidor) . "\n </table>\n\t</td>\n <td width='3%'><div style='height:120px; width:1px; margin-top:-20px; margin-left:4px'></div></td>\n <td width='48%'><table width='100%' border='0'>\n " . vencimento('D', $cli_id, $ano_mes, $parcela, $id_servidor) . "\n\t <p> </p>\n\t <p> </p>\n </table></td>\n </tr>\n</table>\n\n<hr>\n\n<table width='100%' border='0'>\n <tr>\n <td width='38%' align='right'><span class='textotal'>T O T A L > > ></span></td>\n <td width='11%' bgcolor='#CCCCCC' bordercolor='#000000'><span class='textotal'>" . $obj['tot_venctos'] . "\n </span></td>\n <td width='3%'></td>\n <td width='35%' align='right'><span class='textotal'>T O T A L > > ></span></td>\n <td width='13%' bgcolor='#CCCCCC' bordercolor='#000000'><span class='textotal'>\n " . $obj['tot_descontos'] . "\n </span></td>\n </tr>\n <tr>\n <td align='right'><span class='textotal'>S A L Á R I O L I Q U I D O > > ></span></td>\n <td bgcolor='#CCCCCC' bordercolor='#000000'><span class='textotal'>\n " . $obj['sal_liquido'] . "\n </span></td>\n <td> </td>\n <td> </td>\n <td> </td>\n </tr>\n</table>\n</div>\n\n\n<br>\n<br>\n\n<table width='100%' border='1'>\n <tr>\n <td><table width='100%' border='0'>\n <tr>\n <td width='25%'>Vencto Base<br>\n " . $obj['vencto_base_cargo'] . $tipoval . " </td>\n <td width='25%'>Base Calc. Previd. <br>\n " . $obj['bc_previd'] . "</td>\n <td width='18%'>Base Calc. IRRF <br>\n " . $obj['bc_irrf'] . "</td>\n <td width='16%'>Depend.<br>\n " . $obj['qtd_depend_irrf'] . "</td>\n <td width='16%'>Deduções<br>\n " . $obj['tot_deduc_depend'] . "</td>\n </tr>\n </table></td>\n </tr>\n</table>\n\n<br><br>\n\n<table width='100%' border='1' align='center'>\n <tr>\n <td>\n \n <p> </p>\n <p align='center'>" . $obj['pagto_quitacao'] . "</p>\n <p> </p>\n \n </td>\n </tr>\n</table>\n\n\n\n\n\n</body>\n</html> "; //Aqui nós chamamos a class do dompdf require_once 'dompdf/dompdf_config.inc.php'; //É fundamental definir o TIMEZONE de nossa região para que não tenhamos problemas com a geração. date_default_timezone_set('America/Sao_Paulo'); //Aqui eu estou decodificando o tipo de charset do documento, para evitar erros nos acentos das letras e etc. $valhtml = utf8_decode($valhtml); //Instanciamos a class do dompdf para o processo $dompdf = new DOMPDF(); //Aqui nós damos um LOAD (carregamos) todos os nossos dados e formatações para geração do PDF $dompdf->load_html($valhtml); //string $orientation: 'portrait' or 'landscape' //$dompdf->set_paper('legal','portrait'); $dompdf->set_paper('legal', 'A4'); //$dompdf->set_paper(array(0,0,750,1030)); //Aqui nós damos início ao processo de exportação (renderizar)
<?php echo vencimento("V", $cli_id, $ano_mes, $parcela, $id_servidor); ?> <div class="leftx" style="width:100%"> </div> <div class="leftx" style="width:100%"> </div> <!--div class="leftx" style="width:8%">1</div> <div class="leftx" style="width:58%">2fgfgn</div> <div class="leftx" style="width:14%">3</div> <div class="leftx" style="width:20%">4</div></div--> </td> <td colspan="4"> <?php echo vencimento("D", $cli_id, $ano_mes, $parcela, $id_servidor); ?> <!--div class="leftx" style="width:8%">1</div> <div class="leftx" style="width:58%">2fgfgn</div> <div class="leftx" style="width:14%">3</div> <div class="leftx" style="width:20%">4</div--> </td> </tr> </table>
echo vencimento("V", $cli_id, $ano_mes, 0, $id_servidor); ?> <div class="leftx" style="width:100%"> </div> <div class="leftx" style="width:100%"> </div> <!--div class="leftx" style="width:8%">1</div> <div class="leftx" style="width:58%">2fgfgn</div> <div class="leftx" style="width:14%">3</div> <div class="leftx" style="width:20%">4</div></div--> </td> <td colspan="4"> <div class="leftx" style="width:100%;"> </div> <?php echo vencimento("D", $cli_id, $ano_mes, 0, $id_servidor); ?> <div class="leftx" style="width:100%"> </div> <div class="leftx" style="width:100%"> </div> <div class="leftx" style="width:100%"> </div> <!--div class="leftx" style="width:8%">1</div> <div class="leftx" style="width:58%">2fgfgn</div> <div class="leftx" style="width:14%">3</div> <div class="leftx" style="width:20%">4</div--> </td> </tr>