**************************/ for ($i = 1; $i <= 12; $i++) { $tpl->MESLISTNUM = $i; $tpl->MESLIST = getMesNome($i) . "/" . $ano_ref; $tpl->block('EACH_MESLIST'); } $sql_cont = $_SESSION['nivel'] != 1 ? "SELECT id FROM daee_contratos WHERE permissao={$nivel}" : "SELECT id FROM daee_contratos"; $query_cont = mysql_query($sql_cont); $qtd = 0; if (mysql_num_rows($query_cont) > 0) { $i = 1; while ($res = mysql_fetch_array($query_cont)) { $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');