Viewing file: conta_pagamentos_detalhes.php (19.26 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
// Includes
include("../../config/config.php");
include(INCLUDES . "inc_Funcoes.php");
include(INCLUDES . "inc_Conexao.php");
include(INCLUDES . "valida_usuario.inc.php");
$nivel = '../';
$voltar = $_SERVER['HTTP_REFERER'];
$hoje = date('d/m/Y');
//print_r($_GET);
if ($_POST) {
$comprovante = $_FILES['arquivo'];
$imgComprovante = $_FILES['arquivo']['name'];
$partesNome = explode('.',$imgComprovante);
$conta = (count($partesNome)-1);
$extensaoArquivo = $partesNome[$conta];
$novoNomeArquivo = md5(uniqid(rand(), true)) . "." . $extensaoArquivo;
extract($_POST);
if (!empty($comprovante)) {
//echo $comprovante['name'];
//$imgComprovante = $comprovante['name'];
$imgComprovante = $novoNomeArquivo;
// Caminho de onde ficará a imagem
$caminho_imagem = "comprovantes/" . $imgComprovante;
// Faz o upload da imagem para seu respectivo caminho
move_uploaded_file($comprovante["tmp_name"], $caminho_imagem);
} else {
$imgComprovante = '';
}
/*
echo '<p>'.$imgComprovante.'</p>';
echo '<pre>';
print_r($_POST);
echo '</pre>';
*/
//echo '<pre>'; print_r($conta); echo "</pre>";
if(trim($dtPagamento) == "")
{
?>
<script type="text/javascript">
alert('Data invalida');
window.location = 'conta_busca_pagamentos.php';
</script>
<?php
die();
}
else
{
$dia = substr($dtPagamento, 0, 2);
$mes = substr($dtPagamento, 3, 2);
$ano = substr($dtPagamento, 8, 2);
//echo $dia . ' ' . $mes . ' ' .$ano;
//die();
if(!checkdate($mes, $dia, $ano))
{
?>
<script type="text/javascript">
alert('Data invalida');
window.location = 'conta_busca_pagamentos.php';
</script>
<?php
die();
}
}
//die();
foreach ($conta as $conta) {
//echo $conta.' - '.$imgComprovante.' - '.arrumaData($dtPagamento,'grava').'<br />';
$obj->CON_RowID = $conta;
$obj->CON_PagoSN = 'S';
$obj->CON_DataPagamento = arrumaData($dtPagamento,'grava');
$obj->CON_ImgComprovante = $imgComprovante;
echo '<pre>';
print_r($obj);
echo '</pre>';
if (salva("FUN_ContasInternas",$obj)) {
$erro = 0;
$msg = "Conta(s) atualizada(s) com SUCESSO!";
} else {
$erro = 1;
$msg = "Problema na atualização da(s) conta(s)! Por favor, tente novamente!";
}
?>
<script type="text/javascript">
alert('<?= $msg?>');
parent.location = 'conta_pagamentos_liberados.php';
</script>
<?php
}
}
if ($_GET) {
extract($_GET);
$idArq = $id;
if ($oq == 'detalha') {
$titulo = 'Acompanhamento das Liberações de Pagamentos';
} else {
$titulo = 'Listagem de Pagamentos Liberados - Pendentes de Pagamento';
}
$sqlBancos = "
SELECT
DISTINCT(CON_TipoPagamento_DR) as CON_TipoPagamento_DR,
PAG_Nome
FROM FUN_ContasInternas
INNER JOIN FUN_TipoPagamento ON PAG_RowID = CON_TipoPagamento_DR
";
if ($idArq != '') {
$sqlBancos .= "WHERE CON_ArquivoAssinado_DR = $idArq
AND CON_TipoPagamento_DR = 3";
} else
if ($dtVenc != '') {
$sqlBancos .= "WHERE CON_DataVencimento = '$dtVenc'
AND CON_TipoPagamento_DR <> 3";
} else
if ($idCont != '') {
$sqlBancos .= "WHERE CON_RowID = '$idCont' ";
}
$sqlBancos .= "
AND CON_PagoSN = 'N'
ORDER BY PAG_Nome
";
$bancos = executa($sqlBancos);
/*
echo '<pre>';
//print_r($bancos);
echo $sqlBancos;
echo '</pre>';
*/
} else {
?>
<script type="text/javascript">
history.go(-1);
</script>
<?php
}
/*if ($_POST) {
extract($_POST);
$comprovante = $_FILES['arquivo'];
// echo '<pre>';
// print_r($_POST);
// echo '</pre>';
if (!empty($comprovante)) {
//echo $comprovante['name'];
$imgComprovante = $comprovante['name'];
// Caminho de onde ficará a imagem
$caminho_imagem = "comprovantes/" . $imgComprovante;
// Faz o upload da imagem para seu respectivo caminho
move_uploaded_file($comprovante["tmp_name"], $caminho_imagem);
} else {
$imgComprovante = '';
}
// echo '<p>'.$imgComprovante.'</p>';
// echo '<pre>';
// print_r($_POST);
// echo '</pre>';
foreach ($conta as $conta) {
//echo $conta.' - '.$imgComprovante.' - '.arrumaData($dtPagamento,'grava').'<br />';
$obj->CON_RowID = $conta;
$obj->CON_PagoSN = 'S';
$obj->CON_DataPagamento = arrumaData($dtPagamento,'grava');
$obj->CON_ImgComprovante = $imgComprovante;
// echo '<pre>';
// print_r($obj);
// echo '</pre>';
if (salva("FUN_ContasInternas",$obj)) {
$erro = 0;
$msg = "Conta(s) atualizada(s) com SUCESSO!";
} else {
$erro = 1;
$msg = "Problema na atualização da(s) conta(s)! Por favor, tente novamente!";
}
?>
<script type="text/javascript">
alert('<?= $msg?>');
parent.location = 'conta_pagamentos_liberados.php';
</script>
<?php
}
} */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Description" content="IRPEN">
<meta name="Keywords" content="">
<meta name="resource-type" content="document">
<meta name="classification" content="Internet">
<meta name="robots" content="all">
<meta name="rating" content="General">
<meta name="Author" content="Ninart! Solucoes para Web.">
<meta name="language" content="pt-br">
<link rel="shortcut icon" href="imagens/favicon.gif"type="image/gif">
<link rel="stylesheet" href="<?= HOST;?>css/irpen.css" type="text/css" />
<link rel="stylesheet" media="all" type="text/css" href="<?= HOST;?>css/menu_dropline.css" />
<!--[if IE]>
<link rel="stylesheet" media="all" type="text/css" href="css/menu_dropline_ie.css" />
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" media="all" type="text/css" href="css/menu_dropline_ie6.css" />
<![endif]-->
<title>IRPEN | Instituto de Registro Civil de Pessoas Naturais do Paraná - 2008</title>
<script type="text/javascript" src="<?= HOST;?>includes/jquery.js"></script>
<script type="text/javascript" src="<?= HOST;?>includes/funcoes.js"></script>
<script type="text/javascript">
/**
* valida se uma data é válida
* @param campo
* @param valor
* @returns {Boolean}
*/
function validaDat(campo,valor)
{
var date=valor;
var ardt=new Array;
var ExpReg=new RegExp("(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[012])/[12][0-9]{3}");
ardt=date.split("/");
erro=false;
if ( date.search(ExpReg)==-1){
erro = true;
}
else if (((ardt[1]==4)||(ardt[1]==6)||(ardt[1]==9)||(ardt[1]==11))&&(ardt[0]>30))
erro = true;
else if ( ardt[1]==2) {
if ((ardt[0]>28)&&((ardt[2]%4)!=0))
erro = true;
if ((ardt[0]>29)&&((ardt[2]%4)==0))
erro = true;
}
if (erro) {
//alert("\"" + valor + "\" não é uma data válida!!!");
//campo.focus();
//campo.value = "";
return false;
}
return true;
}
function validaSubmit(f) {
var contaMarcado = 0;
$(".chkBox"+f).each(function(){
if (this.checked == true)
contaMarcado++;
});
if (contaMarcado == 0) {
alert('Selecione ao menos uma conta antes de confirmar!');
return false;
}
/*
if ($('#arquivo'+f).val() == '') {
alert('Selecione a imagem do comprovante de pagamento antes de confirmar!');
return false;
}
*/
if ($('#dtPagamento'+f).val() == '') {
alert('Informe a data de pagamento!');
return false;
}
if(!validaDat('dtPagamento',$('#dtPagamento'+f).val()))
{
alert('Data de pagamento inválida!!');
return false;
}
return true;
}
function excluir(conta) {
if (confirm('Confirma a exclusao da conta?')) {
//parent.inferior.location = 'conta_excluir.php?id='+conta;
$('#resultado').load('conta_excluir.php?id='+conta);
}
}
function altImg(id,param,pag,qual) {
$('#idConta').val('');
$('#parametros').val('');
$('#arquivo_'+pag).val('');
$('#altImagem_'+pag).slideUp('fast');
$('#idConta').val(id);
$('#parametros').val(param);
$('#altImagem_'+pag).slideDown('fast');
}
function fechaDiv() {
$('.frmAltImagem').slideUp('fast');
}
function validaSubmitImg(id) {
if ($('#arquivo_'+id).val() == '') {
alert('Selecione o arquivo e depois clique em Gravar');
return false;
} else {
$('#btnGravar').attr('disabled',true);
$('#btnGravar').val('Aguarde...');
return true;
}
}
</script>
<style type="text/css">
<!--
.style1 {
color: #666666;
font-weight: bold;
}
-->
</style>
</head>
<body>
<div id="wrap">
<?php include "../topo_gestao.php";?>
<!-- content-wrap starts -->
<div id="content-wrap">
<table width="100%" border="0">
<tr><!--
<td align="left" valign="top" width="20%">
<?php
//Menu do site
//include(DIR_ADMIN . "menu_gestao.php");
?>
</td>
<td align="left" valign="top" bgcolor="#cccccc">
</td>-->
<td align="left" valign="top" bgcolor="#FFFFFF" width="1%">
</td>
<td align="left" valign="top">
<table width="100%" border="0" >
<tr>
<td align="left" valign="top">
<h2>Detalhamento da Conta</h2>
<div id="linha_h2" >
</div>
<div id="corpo">
<?php
$f = 1;
if (!empty($bancos)) {
//echo '<p>entrou</p>';
foreach($bancos as $bancos) {
$idBanco = $bancos['CON_TipoPagamento_DR'];
?>
<div id="altImagem_<?= $idTipo?>" class="frmAltImagem" style="display:none">
<form enctype="multipart/form-data" name="frmImagem" id="frmImagem_<?= $idTipo?>" method="post" action="conta_gravaImg.php" onSubmit="return validaSubmitImg('<?= $idTipo?>');" target="recipiente">
<table width="430" align="center" class="tabela">
<tr>
<td width="400"><h3>A imagem enviada será adicionada a conta selecionada.</h3></td>
<td align="center"><a style="cursor:pointer;" onClick="fechaDiv();" ><span style="color:#000; background-color:#FFF; width:20px;" alt="Fechar" title="Fechar"><strong>X</strong></span></a></td>
</tr>
<tr>
<td colspan="2">
<input name="CON_RowID" type="hidden" id="CON_RowID" value="<?= $idCont?>" />
<input type="hidden" name="tpAlt" id="tpAlt" value="1" />
<input name="chamou" type="hidden" id="chamou" value="<?= base64_encode('conta_pagamentos_detalhes.php?idCont='.$idCont.'&id='.$id)?>" />
</td>
</tr>
<tr>
<td colspan="2" align="center">Selecione a imagem:
<input type="file" name="CON_ImgDoc" id="arquivo_<?= $idTipo?>" />
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="btnGravar" id="btnGravar" value="Gravar" /></td>
</tr>
</table>
</form>
</div>
<form action="" method="post" enctype="multipart/form-data" name="form<?= $f?>" id="form<?= $f?>" onSubmit="return validaSubmit('<?= $f?>')" target="recipiente" >
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="2" class="tabela2">
<tr>
<td colspan="8">Banco: <?= utf8_decode($bancos['PAG_Nome'])?></td>
</tr>
<tr bgcolor="#CCCCCC">
<th>Fornecedor</th>
<th>Histórico</th>
<th>Número do Cheque</th>
<th>Referência</th>
<th width="100" align="center">Valor</th>
<?php if ($oq != 'detalha') { ?>
<th width="50">Opção</th>
<?php } ?>
<th width="50">Vis.</th>
<th width="50">Detal.</th>
<?php if(($idBanco <> 3) || (($idBanco == 3) && ($bancos['CON_ModDebito'] == 4)) ) { ?>
<th width="50">Excluir</th>
<?php } ?>
</tr>
<?php
$sqlContas = "
SELECT
CON_RowID,
CON_TipoPagamento_DR,
FOR_Nome,
CON_Referencia,
CON_NumCheque,
CON_Historico,
CON_DataVencimento,
CON_Valor,
CON_ArquivoAssinado_DR,
CON_ImgDoc
FROM FUN_ContasInternas
INNER JOIN FUN_Fornecedores ON FOR_RowID = CON_Fornecedor_DR
WHERE CON_AtivoSN = 'S'
";
if ($idArq != '') {
$sqlContas .= "AND CON_ArquivoAssinado_DR = $idArq ";
} else
if ($dtVenc != '') {
$sqlContas .= "AND CON_DataVencimento = '$dtVenc' ";
}
if($idCont != '')
$sqlContas .= " AND CON_RowID = '$idCont'";
$sqlContas .= "
AND CON_TipoPagamento_DR = $idBanco
AND CON_PagoSN = 'N'
ORDER BY FOR_Nome
";
/*echo '<pre>';
print_r($sqlContas);
echo '</pre>';
*/
$contas = executa($sqlContas);
?>
<?php
$l = 0;
$cor = array('#FFF','#EEE');
if (!empty($contas)) {
foreach($contas as $conta) {
?>
<tr style="background-color:<?= $cor[$l%2]?>" onMouseMove="this.style.background='<?= $cor_fundo_lista?>'; this.style.color='<?= $cor_letra_lista?>';" onMouseOut="this.style.background='<?= $cor[$l%2]?>'; this.style.color='#5A5A5A';">
<td><?= utf8_decode($conta['FOR_Nome'])?></td>
<td><?= utf8_decode($conta['CON_Historico'])?></td>
<td><?= utf8_decode($conta['CON_NumCheque'])?></td>
<td><?= utf8_decode($conta['CON_Referencia'])?></td>
<td><div style="float:left; width:15px;">R$</div>
<div style="float:left; width:75px; text-align:right;"><?= number_format($conta['CON_Valor'],2,',','.')?></div></td>
<?php if ($oq != 'detalha') { ?>
<td align="center"><input name="conta[]" type="checkbox" class="chkBox<?= $f?>" id="conta_<?= $conta['CON_RowID']?>" style="border:none;" value="<?= $conta['CON_RowID']?>" /></td>
<?php } ?>
<td align="center">
<?php if ($conta['CON_ImgDoc'] != '') { ?>
<a href="documentos/<?= $conta['CON_ImgDoc']?>" target="_blank"><img src="<?= HOST;?>imagens/icones/lupa.gif" border="0" alt="Visualizar Documento" /></a>
<?php } else { ?>
<!--a href="conta_cad.php?idCon=<?= $conta['CON_RowID']?>&img=1"><img src="../imagens/icones/editar.gif" border="0" alt="Inserir Imagem" /></a-->
<a style="cursor:pointer;" onClick="altImg('<?= $CON_RowID?>','<?= $params?>','<?= $idTipo?>','doc')"><img src="../imagens/icones/editar.gif" border="0" alt="Inserir Imagem" title="Inserir Imagem" /></a>
<?php } ?>
</td>
<td align="center">
<a style="cursor:pointer;" onClick="window.open('conta_detalhada.php?idCon=<?= $conta['CON_RowID']?>','','width=1000,height=500,resizable=yes');"><img src="../imagens/icones/lupa.gif" border="0" alt="Detalhamento" title="Detalhamento" /></a>
</td>
<?php if(($idBanco <> 3) || (($idBanco == 3) && ($bancos['CON_ModDebito'] == 4)) ) { ?>
<td align="center">
<img src="../imagens/icones/excluir.gif" border="0" alt="Inserir Imagem" onClick="excluir(<?= $conta['CON_RowID']?>)" />
</td>
<?php } ?>
<?php
$l++;
$valorTotal += $conta['CON_Valor'];
}
?>
</tr>
<tr>
<td colspan="9"><hr /></td>
</tr>
<?php if ($oq != 'detalha') { ?>
<tr>
<td colspan="9">Comprovante de Pagamento:
<input type="file" name="arquivo" id="arquivo<?= $f?>" /></td>
</tr>
<tr>
<td colspan="9">Data de Pagamento:
<input name="dtPagamento" type="text" id="dtPagamento<?= $f?>" size="10" maxlength="10" onKeyPress="return txtBoxFormat(this, '99/99/9999', event);" value="" />
<input type="submit" name="btConfirma" id="btConfirma<?= $f?>" value="Confirmar" /></td>
</tr>
<tr>
<td colspan="9"> </td>
</tr>
<?php } ?>
<?php
/*echo '<pre>';
$_POST;
echo '</pre>';
die();*/ ?>
</table>
</form>
<?php
$f++;
}
}
$idArquivo = $conta['CON_ArquivoAssinado_DR'];
$sqlAssinaturas = "
SELECT
ASC_Nome, DATE_FORMAT(RSA_DataHoraAssinatura, '%d/%m/%Y %H:%i:%s') AS DataAssinatura
FROM FUN_PagamentoSinteticoAssinado
INNER JOIN FUN_Assinaturas_Contas ON ASC_Contato_DR = RSA_Assinaturas_DR
WHERE RSA_ArquivoAssinado_DR = $idArquivo
";
$assinaturas = executa($sqlAssinaturas);
?>
<iframe name="recipiente" id="recipiente" width="1" height="1"></iframe>
<?php
} else {
echo '<p style="color:#F00; font-weight:bold; text-align:center;">NÃO EXISTEM CONTAS EM ABERTO</p>';
}
?>
<?php if (!empty($bancos)) { ?>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="2" class="tabela2">
<div id="resultado"></div>
<tr>
<td width="250"> </td>
</tr>
<tr>
<td align="center"><input type="button" name="voltar" id="voltar" value="Voltar" onClick="window.location = '<?= $voltar?>'" /></td>
</tr>
</table>
<?php } ?>
</div>
</td>
</tr>
</table>
<br />
</td>
</tr>
</table>
</div>
<div align="center">
<strong><br />
Rua Mal. Deodoro, 51 - Galeria Ritz - 18º Andar | Fone: (41) 3232-9811 | CEP 80.020-905 - Curitiba - Paraná</strong>
<!-- content-wrap ends-->
</div>
<!-- footer starts -->
<div id="footer-wrap">
</div>
<div id="rodape">
</div>
</div>
<div id="resultado"></div>
</body>
</html>
|