if ($resultado) { foreach ($resultado as $item) { $documento->setId($item['id']); $documento->setCodGRD($item['cod_carta']); } } else { $documento->setId(""); $documento->setCodGRD(""); } //Verifica se a acao de salvar foi iniciada if (!empty($_POST['cmd']) && $_POST['cmd'] == 'finaliza') { $documento->setDataEntrega($_POST['dat_entrega'], "converter"); $documento->setLocal($_POST['caixa']); //Verifica se o nome foi preenchido if (!empty($id) && $_FILES['file']['error'] != 4) { $retorno = $DAO->FinalizarCarta($documento->getId(), $documento->getDataEntrega(), $documento->getLocal()); if ($retorno > 0) { $retorno = $DAO->CriarUpload($retorno, $_FILES['file']); if ($retorno == true) { echo '<script language= "JavaScript">alert("Documento Finalizado com sucesso");</script>'; echo '<script language= "JavaScript">location.href="index.php";</script>'; } else { print_r($retorno); } } else { echo '<script language= "JavaScript">alert("Documento não foi finalizado!");</script>'; echo '<script language= "JavaScript">location.href="index.php";</script>'; } } else { echo '<script language= "JavaScript">alert("Anexe documento para Finalizar!");</script>'; echo '<script language= "JavaScript">location.href="finaliza.php?id' . $documento->getId() . '";</script>';
?> /js/mascaras.js"></script> <?php /** Error reporting */ // error_reporting(E_ALL); // ini_set('display_errors', TRUE); // ini_set('display_startup_errors', TRUE); define('EOL', PHP_SAPI == 'cli' ? PHP_EOL : '<br />'); date_default_timezone_set('America/Belem'); /** PHPExcel_IOFactory */ require_once dirname(__FILE__) . '/../../lib/excel/Classes/PHPExcel/IOFactory.php'; // echo date('H:i:s') , " Load from Excel5 template" , EOL; $objReader = PHPExcel_IOFactory::createReader('Excel5'); $objPHPExcel = $objReader->load("../../arquivos/GRD.xls"); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('P1', $documento->getCodGRD())->setCellValue('A5', $documento->getDestinatario())->setCellValue('K5', $documento->getDataEnvioBR())->setCellValue('R5', $documento->getLocal())->setCellValue('F5', $documento->getAtencao())->setCellValue('A24', $documento->getObservacao()); if ($resultado_doc) { $ordem = 0; foreach ($resultado_doc as $item) { switch ($item['midia']) { case 'A': $midia = "PA"; break; case 'B': $midia = "DM"; break; case 'C': $midia = "DE"; break; } $objPHPExcel->setActiveSheetIndex(0)->setCellValue('B3' . $ordem, $item['documento'])->setCellValue('F3' . $ordem, $item['formato'])->setCellValue('H3' . $ordem, $item['assunto'])->setCellValue('M3' . $ordem, $item['num_paginas'])->setCellValue('N3' . $ordem, $item['tipo_emissao'])->setCellValue('P3' . $ordem, $item['quantidade'])->setCellValue('Q3' . $ordem, $midia)->setCellValue('S3' . $ordem, $item['conteudo'])->setCellValue('T3' . $ordem, $item['fin_devolucao']);
$PHPWord->addParagraphStyle('pStyle', array('spacing' => 100, 'name' => 'Times New Roman', 'bold' => false, 'size' => 11, 'align' => 'center', 'spaceAfter' => 100)); $PHPWord->addFontStyle('BoldText', array('name' => 'Times New Roman', 'bold' => true, 'size' => 12)); $PHPWord->addFontStyle('texto', array('name' => 'Arial', 'bold' => false, 'size' => 11)); $PHPWord->addFontStyle('texto_sublinhado', array('name' => 'Arial', 'bold' => false, 'size' => 11, 'underline' => PHPWord_Style_Font::UNDERLINE_SINGLE)); $PHPWord->addFontStyle('titulo', array('name' => 'Thorndale', 'size' => 12, 'bold' => false, 'align' => 'center', 'spaceAfter' => 100)); // Add table style $PHPWord->addTableStyle('tbl13', $styleTable); // Add header $header = $section->createHeader(); // Add table $table = $header->addTable('tbl13'); // variaveis que recebem o texto $assunto = utf8_decode($documento->getAssunto()); $msg2 = utf8_decode("SISTEMA TRONCAL DE ÔNIBUS DA REGIÃO METROPOLITANA DE BELÉM"); $pagina = utf8_decode("Página"); $local = utf8_decode($documento->getLocal()); $observacao = utf8_decode($documento->getObservacao()); //documento $table->addRow(); $styleCell = array('gridSpan' => 2); $styleTable = array('cellMarginLeft' => 110, 'cellMarginRight' => 110, 'borderSize' => 1); $table->addCell(2500, array('vMerge' => 'restart'))->addImage('C:/Diego/troncal.jpg', array('width' => 170, 'height' => 50, 'align' => 'left')); $table->addCell(4000, array('vMerge' => 'restart'))->addText($assunto, 'titulo', 'pStyle'); $table->addCell(2500)->addText("Data: " . date('d/m/Y'), 'texto'); $table->addRow(); $table->addCell(2500, array('vMerge' => 'fusion')); $table->addCell(2500, array('vMerge' => 'fusion')); $table->addCell(2500)->addPreserveText($pagina . '{PAGE} de {NUMPAGES}', 'titulo'); $table->addRow(); $table->addCell(6500, $styleCell)->addText($msg2, 'titulo', 'pStyle'); $table->addCell(2500)->addText("Cliente: " . $documento->getDestinatario(), 'texto');
<td colspan="7" align="center"> </td> </tr> </thead> <tfoot style="display: table-footer-group;"> <tr> <td colspan="6"><p class="margem"> </p></td> <td colspan="1"><p class="margem" id='page-number'> </p></td> </tr> </tfoot> <tbody> <tr> <td colspan="7"><b class="sublinhado">Local: <?php echo $documento->getLocal(); ?> </b><br> </td> </tr> <tr class="AddBorder"> <td class="AddBorder" colspan="2"> <p align="center" class="margem sublinhado"><b>Participante</b></p> <p class="margem"> <?php foreach ($pessoa as $item) { echo '<p class="margem">' . $item . '</p>'; } ?> </p> </td>