public function getObs($obs) { if ($obs != "") { $texto = explode("=@=", $obs); $ret = ""; if (count($texto) > 0) { for ($i = 0; $i < count($texto); $i++) { if ($i % 2 == 0) { $ret .= $texto[$i]; } else { $ret .= "<b>" . ExplodeDateTime($texto[$i]) . "</b>"; } } } else { $ret .= $obs; } return $ret; } else { return ""; } }
while ($res = mysql_fetch_array($query)) { $tpl->CONTID = $res['id']; $cont = new Contrato($res['id']); $autos = $cont->isAutos() ? "Autos " : "Processo "; $num = $cont->isAutos() ? number_format($cont->get('numero'), 0, ',', '.') : $cont->get('numero'); $nome = $cont->get('nome'); $servico = $cont->get('empresa')->getServicos()[$cont->get('servico')]->children(); //$tpl->CONTNOME = $autos." n°".$num." - ".$nome."::".$servico; $tpl->CONTNOME = $cont->geraNome(); $tpl->CONTCONT = $cont->get('contrato'); $tpl->CONTEMP = $cont->get('empresa')->getNome(); $tpl->CONTLICIT = $cont->get('comlicit') == 1 ? "Sim" : "Não"; $de = $cont->get('data'); $ate = $cont->get('vigencia'); $tpl->CONTVIG = $de == "0000-00-00" ? "--" : $de . " a " . $ate; $tpl->CONTEM = ExplodeDateTime($cont->get('criado')); $tpl->CONTUDD = $cont->get('unidade')->getSigla(); $tpl->block('EACH_CONTRATO'); } } else { $tpl->addFile('CONTEUDO', 'html_libs/ger_addContrato-form.html'); $emp = new Empresa(); $alerta = ""; $valid = 0; if (getenv("REQUEST_METHOD") == "POST") { if (isset($_POST['tipo'], $_POST['numero'], $_POST['titulo'], $_POST['licit-bool'], $_POST['empresa'])) { $tipo = (int) $_POST['tipo']; $numero = mysql_real_escape_string($_POST['numero']); $titulo = mysql_real_escape_string($_POST['titulo']); $licit = (int) $_POST['licit-bool']; $empresa = (int) $_POST['empresa'];
$contrato = new Contrato($res['id']); $tpl->AUTOS = $i . " - " . $contrato->geraNome(); $tpl->PERIODO = getMesNome($mes_ref, false) . "/" . $ano_ref; $notas = $contrato->getAllNotasByRef($mes_ref, $ano_ref, false); if (count($notas) > 0) { if ($notas[0]['id'] != null) { foreach ($notas as $nota) { $tpl->NOTANUM = $nota['numero']; $tpl->UO = $nota['unidade']; $tpl->UC = $nota['rgi'] . " - [ <small>" . $nota['compl'] . "</small> ]"; $tpl->EMPRESA = $nota['nome']; $tpl->DATAREF = getMesNome($nota['mes_ref']) . "/" . $nota['ano_ref']; $tpl->CONSUMO = tratarValor($nota['consumo']); $tpl->VALOR = tratarValor($nota['valor'], true); $tpl->EMISSAO = setDateDiaMesAno($nota['emissao']); $tpl->LANCTO = ExplodeDateTime($nota['criado'], true); $tpl->SUBMIT = '<input type="button" value="EDITAR" class="button" name="ope_editarNota.php?chave=' . $nota['id'] . '" />'; $tpl->NOTAID = $nota['id']; $tpl->block('EACH_NOTAS'); } } else { $tpl->block('SEM_NOTAS'); } } //$tpl->SQL = $notas; $tpl->block("EACH_CONTRATO"); $i++; } $tpl->block("TABLE_BODY"); } }
<?php require "src/scripts/conecta.php"; require "src/scripts/restrito.php"; include "src/scripts/functions.php"; require "src/classes/Template.class.php"; include_once "src/classes/Users.class.php"; include_once "src/classes/Notas.class.php"; include_once "src/classes/Contratos.class.php"; include_once "src/classes/Relatorio.class.php"; redirectByPermission(1); // SETAR PERMISSÃO DA PÁGINA $inicio = execucao(); $tpl = new Template('html_libs/template.html'); $tpl->addFile('SECONDMENU', 'html_libs/udd_secondMenu.html'); $tpl->addFile('CONTEUDO', 'html_libs/rel_history.html'); $sql = "SELECT * FROM rel_history GROUP BY sigla, data"; $query = mysql_query($sql); while ($res = mysql_fetch_array($query)) { $tpl->USER = $res['usuario']; $tpl->SIGLA = $res['sigla']; $data_ref = explode("-", $res['data_ref']); $tpl->MESREF = getMesNome($data_ref[1]) . "/" . $data_ref[0]; $tpl->DLDATE = ExplodeDateTime($res['data']); $tpl->block('EACH_HIST'); } $fim = execucao(); $tempo = number_format($fim - $inicio, 6); $tpl->EXECTIME = "Tempo de Execução: <b>" . $tempo . "</b> segundos "; $tpl->show();