}
/********************************************
	  MOSTRAR TABELA COM NOTAS VINDAS DE $_POST
	********************************************/
if (getenv("REQUEST_METHOD") == "POST") {
    if (isset($_POST['mes_ref'], $_POST['ano_ref'])) {
        $mes = $_POST['mes_ref'] == "" ? "nulo" : $_POST['mes_ref'];
        $ano = $_POST['ano_ref'] <= Date('Y') || $_POST['ano_ref'] >= 2012 ? $_POST['ano_ref'] : Date('Y');
        $tpl->MESNOME = strtoupper(getMesNome($mes, false));
        $tpl->ANO = $ano;
        $sql_cont = "SELECT id FROM daee_contratos";
        $query_cont = mysql_query($sql_cont);
        $qtd = 0;
        $i = 0;
        $rel = new Relatorio();
        $rel->setUdds();
        $udds = $rel->udds;
        $cores = $rel->cores;
        $tipos = $rel->ucTipos;
        if (mysql_num_rows($query_cont) > 0) {
            while ($res = mysql_fetch_array($query_cont)) {
                $contrato = new Contrato($res['id']);
                $notas = $contrato->getFaltaNotas($mes, $ano);
                if ($notas[0]['ucid'] != null) {
                    $qtd += count($notas);
                    foreach ($notas as $nota) {
                        $consTipo = $nota['tipo'];
                        $tpl->UO = $udds[$nota['uo']];
                        $tpl->AUTOS = $contrato->geraNome();
                        $tpl->UC = "<b>" . $nota['rgi'] . "</b> - [ <small>" . $nota['endereco'] . "</small> ]";
                        $tpl->UC .= "<br /><small><font color='" . $cores[$consTipo] . "'>" . $tipos[$consTipo] . "</font></small>";