Пример #1
0
    $tpl->block('EACH_MES_FORM');
}
for ($i = 2012; $i <= Date('Y'); $i++) {
    $tpl->ANO_NUM = $i;
    $tpl->block("EACH_ANO_FORM");
}
if (getenv("REQUEST_METHOD") == "POST") {
    if (isset($_POST['autos'], $_POST['prov'])) {
        $autos = (int) $_POST['autos'];
        $prov = (int) $_POST['prov'];
        $cont = new Contrato($autos);
        $tpl->AUTOS = $cont->geraNome();
        if (isset($_POST['mes_ref'], $_POST['ano_ref']) && $_POST['mes_ref'] != "" && $_POST['ano_ref'] != "") {
            $mes_post = (int) $_POST['mes_ref'];
            $ano_post = (int) $_POST['ano_ref'];
            $notas = $cont->getAllNotasforDof($prov, $mes_post, $ano_post);
        } else {
            $notas = $cont->getAllNotasforDof($prov);
        }
        if (count($notas) > 0) {
            if ($notas[0]['id'] != null) {
                foreach ($notas as $nota) {
                    $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 = $nota['pagto'] == '0000-00-00' ? '<input type="button" value="PAGO" class="button" name="' . $nota['id'] . '" />' : setDateDiaMesAno($nota['pagto']);