$tpl->ANO = $ano; } for ($i = 1; $i <= 12; $i++) { $tpl->MESREF = $i . "-" . Date('Y'); $tpl->MESANOREF = getMesNome($i) . "/" . Date('y'); $tpl->block('EACH_MESMENU'); } $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(); $ucs = $contrato->getFaltaNotas($mes_ant, $ano); if (count($ucs) > 0) { if ($ucs[0]['ucid'] != null) { foreach ($ucs as $uc) { $tpl->RGI = $uc['rgi']; $tpl->ENDERECO = $uc['endereco']; $tpl->ID = $uc['ucid']; $tpl->MES_ANO = $mes_ant . "-" . $ano; $tpl->block('EACH_FALTA'); $qtd++; } } } $tpl->block("EACH_CONTRATO"); $i++; }
$tpl->block('EACH_RGI'); $tpl->block('EACH_OPTGROUP'); } } if (isset($_GET['dataref']) && count(explode('-', $_GET['dataref'])) == 2 || isset($_SESSION['data_ref'])) { $data_ref = isset($_GET['dataref']) ? explode('-', $_GET['dataref']) : explode('-', $_SESSION['data_ref']); $mes = $data_ref[0] > 0 && $data_ref[0] < 13 ? (int) $data_ref[0] : 1; $ano = $data_ref[1] > 2000 ? (int) $data_ref[1] : date('Y'); $conts = $user->getContratos(); if ($conts[0]['id'] != null) { $qtdCont = count($conts); $z = 1; foreach ($conts as $cont) { $contrato = new Contrato($cont['id']); $tpl->CONTNOME = "-------- " . $contrato->geraNome() . " --------"; $rgis = $contrato->getFaltaNotas($mes, $ano); if ($rgis[0]['ucid'] != null) { $qtdRgi = count($rgis); $w = 1; foreach ($rgis as $rgi) { $uc = new UnidadeConsumidora($rgi['ucid']); $tpl->RGID = $rgi['ucid']; $tpl->DISABLE_OPT = ""; $tpl->RGI = $uc->get('rgi'); $tpl->RGINOME = $uc->getEndereco() . " ~> " . $uc->getNome(); $tpl->block('EACH_RGI'); $w++; } } $z++; $tpl->block('EACH_OPTGROUP');