Skip to content

Commit

Permalink
Filtro Pr e Setor
Browse files Browse the repository at this point in the history
  • Loading branch information
hiltonbruce committed Jan 6, 2017
1 parent 61cc6cd commit 0d61951
Show file tree
Hide file tree
Showing 29 changed files with 122 additions and 67 deletions.
2 changes: 1 addition & 1 deletion autentica.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
$_SESSION['nivel'] = $col["nivel"];
$_SESSION['valid_user'] = $col["cpf"];
$_POST["rol"] = $col["cpf"];
$_SESSION['cargo'] = $col["alias"];
$_SESSION['cargo'] = $col["cargo"];
$_SESSION['nome'] = $col["nome"];
$nomeUsuario = explode(' ', $col["nome"]);
$_SESSION['username'] = $nomeUsuario['0'].'_'.$nomeUsuario['1'];
Expand Down
2 changes: 1 addition & 1 deletion controller/despesa.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$ind=1;
if ($_SESSION["setor"]=="2" || $_SESSION["setor"]>"50"){
if ($_SESSION["setor"]=="2" || $_SESSION["setor"]>"50" || $_SESSION["setor"]==1){

require_once 'views/menus/subDespesas.php';//Sub-Menu das despesas

Expand Down
2 changes: 1 addition & 1 deletion controller/recibo.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$ind=1;
if ($_GET['rec']>'19' || $_POST['rec']>'19') {
session_start();
if ($_SESSION["setor"]=="2" || $_SESSION["setor"]>"50"){
if ($_SESSION["setor"]=="2" || $_SESSION["setor"]>"50" || $_SESSION["setor"]==1){
require "../help/impressao.php";//Include de func�es, classes e conex�es com o BD
$igreja = new DBRecord ("igreja","1","rol");
if ($_GET['igreja']>'1') {
Expand Down
2 changes: 1 addition & 1 deletion forms/alt_rec.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php $ind=1;
if ($_SESSION["setor"]==2 || $_SESSION["setor"]>50){
if ($_SESSION["setor"]==2 || $_SESSION["setor"]>50 || $_SESSION["setor"]==1){
$campos = array ("rol","valor","data","fonte","referente","rec","transid");

?>
Expand Down
8 changes: 4 additions & 4 deletions forms/editar_igreja.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@
</tr>
<tr>
<td colspan="3"><label>C&iacute;rculo de Ora&ccedil;&atilde;o:</label>
<?PHP
require_once 'forms/igreja/alterarDiaOracao.php'
?>
</td>
<?PHP
require_once 'forms/igreja/alterarDiaOracao.php'
?>
</td>
</tr>
<tr>
<td colspan="3"><label>Santa Ceia:</label>
Expand Down
9 changes: 4 additions & 5 deletions forms/tes/lancarRec.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
$corpoMens = 'Falha N&atilde;o indentificada de lançamento. Informe ao ';
$corpoMens .= 'admnistrador do sistema!';
}

echo "+++++".$ctaAces[$recDados->fonte()]['id'].'#####'.$recDados->fonte();
// print_r ($ctaAces);
// echo "+++++".$ctaAces[$recDados->fonte()]['id'].'#####'.$recDados->fonte();
// print_r ($_SESSION);
?>
<fieldset>
<legend>Confirma Lan&ccedil;amento Cont&aacute;bil de Recibo</legend>
Expand Down Expand Up @@ -129,8 +128,8 @@
} else {
$titMens = 'Saldo insuficiente - '.$ctaAces[$recDados->fonte()]['titulo'];
$corpoMens = 'Voc&ecirc; deve alterar o caixa do pagamento deste recibo, ou refor&ccedil;a o ';
$corpoMens .= $ctaAces[$recDados->fonte()]['titulo'].' transferido de outro com saldo para ele! ';
$corpoMens .= 'E s&oacute; ent&atilde;o poder&aacute; confirmar este pagamento...';
$corpoMens .= $ctaAces[$recDados->fonte()]['titulo'].' transferido de outro com saldo para ele! ';
$corpoMens .= 'E s&oacute; ent&atilde;o poder&aacute; confirmar este pagamento...';
$btnMes = 'Caixa sem Saldo!';
}
?>
Expand Down
5 changes: 3 additions & 2 deletions func_class/constantes.bkp.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
define ('DBUSER','igreja');
define ('DBPASS','suaSenha');
define ('DBNAME','assembleia');
define ('SECTOR_QUANT','5');#Quantidade de setores da Igreja na cidade
$dns = 'mysql://'.DBUSER.':'.DBPASS.'@'.DBPATH.'/'.DBNAME;
/*
* Usu�rio e senha de Backup:
* usu�rio: igrejaBKP
* Usuário e senha de Backup:
* usuário: igrejaBKP
* senha: abPh!jUEyjs@8EK#xX4
*/
?>
2 changes: 1 addition & 1 deletion func_class/funcoes.php
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ function controle ($tipo){ //O tipo � definido como consulta, atualiza��o,
case "tes":
if ($_SESSION["setor"]<50 && $_SESSION["setor"]!=2){
echo $alerta;
echo "Ative o JavaScript em seu navegador!";
echo "&Aacute;rea para membros da tesouraria!";
return exit;
}
break;
Expand Down
2 changes: 1 addition & 1 deletion help/tes/tipo1DizOferta.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
//$valor = strtr( str_replace(".","",$_POST["$campo"]), ',','. ' );
$value = "'','',$conta,'".$congcontrib."','{$_POST["rol"]}','$nome','$valor',";
$value .= "'$y-$m-$d','$sem','{$_POST["mes"]}','{$_POST["ano"]}','{$rolIgreja}','{$_SESSION['valid_user']}',";
$value .= "'$tesoureiro2','{$_POST["obs"]}',NOW(),'$hist'";
$value .= "'".$_SESSION['setor']."','{$_POST["obs"]}',NOW(),'$hist'";
$dados = new insert ($value,"dizimooferta");
$dados->inserir();
}
Expand Down
6 changes: 3 additions & 3 deletions help/tes/tipo2DizOferta.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
$valor = strtr( str_replace(".","",$_POST["oferta"]), ',','. ' );
$value = "'','','701','1','2','{$_POST["igreja"]}','{$_POST["roloferta"]}','{$_POST["nomeoferta"]}','$valor}',";
$value .= "'$y-$m-$d','$sem','$m','$y','{$_POST["igreja"]}','{$_SESSION['valid_user']}',";
$value .= "'$tesoureiro2','{$_POST["obs"]}',NOW(),'$hist'";
$value .= "'".$_SESSION['setor']."','{$_POST["obs"]}',NOW(),'$hist'";
$dados = new insert ($value,"dizimooferta");
$dados->inserir();
}
if ($_POST['ofertaext']!='') {
$valor = strtr( str_replace(".","",$_POST["ofertaext"]), ',','. ' );
$value = "'','','702','1','3','{$_POST["igreja"]}','{$_POST["rolext"]}','{$_POST["nomeext"]}','$valor',";
$value .= "'$y-$m-$d','$sem','$m','$y','{$_POST["igreja"]}','{$_SESSION['valid_user']}',";
$value .= "'$tesoureiro2','{$_POST["obsext"]}',NOW(),'$hist'";
$value .= "'".$_SESSION['setor']."','{$_POST["obsext"]}',NOW(),'$hist'";
$dados = new insert ($value,"dizimooferta");
$dados->inserir();
}
?>
?>
8 changes: 4 additions & 4 deletions help/tes/tipo3DizOferta.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

$campo = 'oferta'.$i;
//printf ("$campo: %s",$_POST["$campo"]);

$valor = strtr( str_replace(".","",$_POST["$campo"]), ',','. ' );//Captura o valor e vonverte p o padrão americano

if ($valor>0) {
Expand Down Expand Up @@ -71,14 +71,14 @@
}

$congcontrib = ($congcontrib=='') ? $_POST["igreja"]:$congcontrib;

//$valor = strtr( str_replace(".","",$_POST["$campo"]), ',','. ' );
$value = "'','',$conta,'".$congregacao."','{$_POST["rol"]}','$nome','$valor',";
$value .= "'$y-$m-$d','$sem','{$_POST["mes"]}','{$_POST["ano"]}','{$rolIgreja}','{$_SESSION['valid_user']}',";
$value .= "'$tesoureiro2','{$_POST["obs"]}',NOW(),'$hist'";
$value .= "'".$_SESSION['setor']."','{$_POST["obs"]}',NOW(),'$hist'";
$dados = new insert ($value,"dizimooferta");
$dados->inserir();
}

}
?>
?>
8 changes: 4 additions & 4 deletions help/tes/tipo4DizOferta.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

$campo = 'oferta'.$i;
//printf ("$campo: %s",$_POST["$campo"]);

$valor = strtr( str_replace(".","",$_POST["$campo"]), ',','. ' );//Captura o valor e vonverte p o padrão americano

if ($valor>0) {
Expand All @@ -37,14 +37,14 @@
}

$congcontrib = ($congcontrib=='') ? $_POST["igreja"]:$congcontrib;

//$valor = strtr( str_replace(".","",$_POST["$campo"]), ',','. ' );
$value = "'','',$conta,'".$congcontrib."','$rolMembro','$nome','$valor',";
$value .= "'$y-$m-$d','$sem','{$_POST["mes"]}','{$_POST["ano"]}','{$rolIgreja}','{$_SESSION['valid_user']}',";
$value .= "'$tesoureiro2','{$_POST["obs"]}',NOW(),'$hist'";
$value .= "'".$_SESSION['setor']."','{$_POST["obs"]}',NOW(),'$hist'";
$dados = new insert ($value,"dizimooferta");
$dados->inserir();
}

}
?>
?>
4 changes: 2 additions & 2 deletions menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
</button>
<ul class="dropdown-menu">
<li>&nbsp;&nbsp;CPF: <?php echo $_SESSION['valid_user'];?></li>
<li>&nbsp;&nbsp;Setor: <?php echo $_SESSION['cargo'];?></li>
<li>&nbsp;&nbsp;Fun&ccedil;&atilde;o: <?php echo $_SESSION['cargo'];?></li>
<li>&nbsp;&nbsp;Host: <?php echo $_SESSION['computador'];?></li>
<li role="separator" class="divider"></li>
<li>&nbsp;&nbsp;
Expand Down Expand Up @@ -99,7 +99,7 @@
?>
<li><img src="img/divider2.png" alt="" /></li>
<?php
if ($_SESSION["setor"]==2 || $_SESSION["setor"]>50) {
if ($_SESSION["setor"]==2 || $_SESSION["setor"]>50 || $_SESSION["setor"]==1) {
echo $link_tesour.'<li><img src="img/divider2.png" alt="" /></li>';
}
if ($_SESSION["setor"]==2 || $_SESSION["setor"]>50) {
Expand Down
2 changes: 1 addition & 1 deletion models/List_setores.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class List_setores {
//Lista para formulário

function __construct (){
$this->sql_lst = mysql_query('SELECT * FROM setores WHERE hier="1" ORDER BY alias');
$this->sql_lst = mysql_query('SELECT * FROM setores WHERE hier<=1 ORDER BY alias');
}

function List_Setor($ind,$req=null,$setor=null) {
Expand Down
5 changes: 3 additions & 2 deletions models/cad_usuario.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
controle ("admin_user");
if ($_SESSION["setor"]==$_POST["setor"] || $_SESSION["setor"]=='99') {
$hist = $_SESSION['valid_user'].": ".$_SESSION['nome'];
$value = "'','{$_POST["nome"]}','{$_POST["cpf"]}','{$_POST["nivel"]}','{$_POST["setor"]}','{$_POST["cargo"]}',
md5({$_POST["senha"]}),'1','$hist',NOW()";
$value = '"","'.$_POST["nome"].'","'.$_POST["cpf"].'","'.$_POST["nivel"].'",';
$value .='"'.$_POST["setor"].'","'.$_POST["cargo"].'","'.md5($_POST["senha"]).'",';
$value .='"1","$hist",NOW()';
$dados = new insert ($value,"usuario");
$dados->inserir();
echo "<h1>".mysql_insert_id()."</h>";//recupera o id do último insert no mysql
Expand Down
36 changes: 23 additions & 13 deletions models/dizresp.class.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
class dizresp {

function __construct($tesoureiro='',$print='',$tipoCons='') {
function __construct($tesoureiro='',$print='',$tipoCons='',$setor='') {
$this->var_string = "SELECT d.id,d.rol,DATE_FORMAT(d.data,'%d/%m/%Y') AS data,d.congcadastro,";
$this->var_string .= "d.nome,d.mesrefer,d.anorefer,d.tipo,d.valor,d.obs,i.razao,d.credito,d.tesoureiro, ";
$this->var_string .= "d.confirma,i.rol AS rolIgreja,d.hist FROM dizimooferta AS d, igreja AS i ";
Expand Down Expand Up @@ -147,6 +147,8 @@ function dizimistas(
$this->dquery = mysql_query( $consulta.$conSeman.$ordenar ) or die (mysql_error());
$total = 0;
$tabela = '';
$depto = new setores();
$dadoDepto = $depto->arrayDepto();
while ($linha = mysql_fetch_array($this->dquery)) {
//echo $linha['id'].'===='..' -> Valor: R$ '.$linha['valor'].'<br />';
//$mostracta = new DBRecord ('contas',$linha['credito'],'acesso');//Traz os da conta p/ mostrar coluna tipo
Expand Down Expand Up @@ -194,19 +196,21 @@ function dizimistas(
$linkMembro .= '" title="Congrega: '.$nomeCongMembro.' - Lan&ccedil;. por: '.$lancNome.'">';
$linkMembro .= $rol.' - '.$linha['nome'].$mesAno.'</a>';
}
$tabela .= '<tr><td>'.$linha['data'].'</td>
<td>'.$linkMembro.'</td><td>'.$tipo.'</td>
<td class="text-right">'.$corrigir.'</td>
<td class="text-center">'.$linha['razao'].'</td></tr>';
$tabela .= '<tr><td>'.$linha['data'].'</td>';
$tabela .= '<td>'.$linkMembro.'</td>';
$tabela .= '<td>'.$tipo.'</td>';
$tabela .= '<td class="text-center small">'.$dadoDepto[$linha['confirma']]['alias'].'</td>';
$tabela .= '<td class="text-right">'.$corrigir.'</td>';
$tabela .= '<td class="text-center">'.$linha['razao'].'</td></tr>';
$total += $linha['valor'];
}
$total = number_format($total,2,',','.');
$tabela .= '';
if ($total==0) {
$tabela .= '<tfoot><tr id="total"><td colspan="5">N&atilde;o h&aacute; ';
$tabela .= '<tfoot><tr id="total"><td colspan="6">N&atilde;o h&aacute; ';
$tabela .= 'lan&ccedil;amentos para esta busca ou pendentes!</td></tr></tfoot>';
}else {
$tabela .= '<tfoot><tr id="total"><td colspan="4" class="text-right">';
$tabela .= '<tfoot><tr id="total"><td colspan="5" class="text-right">';
$tabela .= 'Total&nbsp;&nbsp;............ &nbsp;&nbsp;'.$total;
$tabela .= '</td><td></td></tr></tfoot>';
}
Expand All @@ -220,7 +224,6 @@ function outrosdizimos ($igreja) {
} else {
$filtroIgreja = 'AND igreja="'.$igreja.'"';
}

$queryCons = 'SELECT SUM(valor) AS valor FROM dizimooferta ';
$queryCons .= 'WHERE tesoureiro<>"'.$this->tesoureiro.'" AND lancamento="0" '.$filtroIgreja;
$this->dquery = mysql_query($queryCons ) or die (mysql_error());
Expand Down Expand Up @@ -292,9 +295,11 @@ function caixamissoes () {
}

function concluir($igreja) {
$this->dquery = mysql_query($this->var_string.'WHERE d.lancamento="0" AND
$this->dquery = mysql_query($this->var_string.'WHERE d.lancamento="0" AND confirma="2" AND
d.igreja="'.$igreja.'" AND d.igreja=i.rol ORDER BY tesoureiro,tipo,nome ') or die (mysql_error());
$totaltes=0;
$depto = new setores();
$dadoDepto = $depto->arrayDepto();
$tabLancamento = '<tbody id="periodo" >';
while ($linha = mysql_fetch_array($this->dquery)) {
//echo $linha['id'].'===='..' -> Valor: R$ '.$linha['valor'].'<br />';
Expand All @@ -317,24 +322,29 @@ function concluir($igreja) {
,$dadostesoureiro->nome(),'.',number_format($totaltes,2,',','.'));}
$tesoureiro = $linha['tesoureiro'];
$dadostesoureiro = new DBRecord('usuario',$tesoureiro, 'cpf');
$tabLancamento .= sprintf('<tr class="danger"><td colspan="5" class="text-right">
$tabLancamento .= sprintf('<tr class="danger"><td colspan="6" class="text-right">
<b> %s </b></td></tr>',$dadostesoureiro->nome());
$totaltes = 0;
//echo '<tr style="background:'.$bgcolor.'"><td>'.$linha['data'].'</td><td>'.$rol.' - '.$linha['nome'].'</td><td>'.$tipo.'</td><td style="text-align:right;">'.$valor.'</td><td>'.$status.'</td></tr>';
}
$totaltes += $vlr;

$tabLancamento .= '<tr><td>'.$linha['data'].'</td><td>'.$rol.'</td><td>'.$tipo.'</td><td class="text-right">'.$valor.'</td><td>'.$status.'</td></tr>';
$tabLancamento .= '<tr><td>'.$linha['data'].'</td>';
$tabLancamento .= '<td>'.$rol.'</td>';
$tabLancamento .= '<td>'.$tipo.'</td>';
$tabLancamento .= '<td class="small">'.$dadoDepto[$linha['confirma']]['alias'].'</td>';
$tabLancamento .= '<td class="text-right">'.$valor.'</td>';
$tabLancamento .= '<td>'.$status.'</td></tr>';
$total += $linha['valor'];
}
$total = number_format($total,2,',','.');
$tabLancamento .= sprintf("<tr id='total'><td colspan='2' class='text-left'>
%s</td><td colspan='3' class='text-right'>Total: %'.100s &nbsp;&nbsp;&nbsp;
&nbsp;<b>%s</b></td></tr>",$dadostesoureiro->nome(),'.',number_format($totaltes,2,',','.'));
&nbsp;<b>%s</b></td><td></td></tr>",$dadostesoureiro->nome(),'.',number_format($totaltes,2,',','.'));
$tabLancamento .= '</tbody>';
$tabLancamento .= '<tfoot><tr class="primary"><td colspan="3"
class="text-right">Total Geral:</td><td colspan="2" class="text-right"
><strong> R$ '.$total.'</strong></td></tr></tfoot>';
><strong> R$ '.$total.'</strong></td><td></td></tr></tfoot>';
return $tabLancamento;
}
}
7 changes: 5 additions & 2 deletions models/feccaixaculto.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
$data = br_data($_POST['data'], 'Data do lançamento inválida!');
if ($dizmista->totalgeral()>'0' && $referente!='' && checadata($_POST['data'])) {
//Faz o lançamento do débito para tabela lancamento
$tablanc = mysql_query('SELECT devedora,tipo,SUM(valor) AS valor,credito FROM dizimooferta
WHERE lancamento="0" AND igreja = "'.$roligreja.'" GROUP BY credito,tipo');
$sqlFecha = 'SELECT devedora,tipo,SUM(valor) AS valor,credito ';
$sqlFecha .= 'FROM dizimooferta WHERE lancamento="0" AND ';
$sqlFecha .= 'igreja = "'.$roligreja.'" AND (confrima="" || confrima="2")';
$sqlFecha .= 'GROUP BY credito,tipo';
$tablanc = mysql_query($sqlFecha);
$exibideb = '<tr class="warning"><td colspan="5">Debito</td></tr>';
$exibicred = '<tr class="warning"><td colspan="5">Credito</td></tr>';
$caixaCentral ='';
Expand Down
18 changes: 18 additions & 0 deletions models/setores.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
class setores {

function __construct (){
$this->result = mysql_query("SELECT * FROM setores ORDER BY alias") or die (mysql_error());
}

function arrayDepto(){
while($this->col_lst = mysql_fetch_assoc($this->result))
{
$setores [$this->col_lst["id"]] = array ("hier"=>$this->col_lst["hier"],"conta"=>$this->col_lst["conta"]
, "alias"=>$this->col_lst["alias"], "descricacao"=>$this->col_lst["descricacao"]
, "codigo"=>$this->col_lst["codigo"]);
}
return $setores;
}
}
?>
9 changes: 2 additions & 7 deletions models/tes/tes_igreja.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,26 @@ function ArraySaldos(){
$valores_array [$resultado['mes']]=$resultado['valor'];
}
return $valores_array;

}

function dataEntrada () {

$ultimaEntrada = 'SELECT d.lancamento,d.data,d.mesrefer,d.anorefer,i.cultos ';
$ultimaEntrada .= 'FROM dizimooferta AS d,igreja AS i WHERE igreja="'.$this->igreja.'" ';
$ultimaEntrada .= 'AND i.rol = d.igreja ';
$verSemLanc .= $ultimaEntrada.' AND d.lancamento="0" ORDER BY d.data DESC LIMIT 1';
$ultimaEntrada .= 'AND i.rol = d.igreja AND confirma="2" ';
$verSemLanc .= $ultimaEntrada.'AND d.lancamento="0" ORDER BY d.data DESC LIMIT 1';
$ultimaEntrada .= 'ORDER BY d.data DESC,d.lancamento ASC LIMIT 1';
$dadosSemLanc = mysql_query($verSemLanc);

if ( mysql_fetch_row($dadosSemLanc)>0) {
#Se possui lançamentos pendentes
$dados = mysql_query($verSemLanc);
} else {
#ultima data de lançamento
$dados = mysql_query($ultimaEntrada);
}

$resUltimoDia = mysql_fetch_array($dados);
//print_r($resUltimoDia);
$dtUltLanc = new DateTime($resUltimoDia['data']);

if ($resUltimoDia['lancamento']=='0' || $resUltimoDia['cultos']=='') {
//print_r($dtUltLanc);
//Culto na data lançamento em aberto
Expand All @@ -52,7 +48,6 @@ function dataEntrada () {
$proxCulto = $dtUltLanc->format('d/m/Y');
$mesLanc = $dtUltLanc->format('m');
$anoLanc = $dtUltLanc->format('Y');

return array('mesrefer' => $mesLanc,
'anorefer' => $anoLanc,'proxCulto'=>$proxCulto
,'igreja'=>$this->igreja );
Expand Down
Loading

0 comments on commit 0d61951

Please sign in to comment.