Viewing file: conta.php (21.56 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");
$pgChamou = $_SERVER['HTTP_REFERER'];
//echo $pgChamou.'<br />';
if ($_GET['idCon']) {
$idCon = $_GET['idCon'];
$labelBotao = 'Alterar';
$where = "CON_RowID = $idCon";
$contas = lista('FUN_ContasInternas',$where);
foreach($contas as $conta) {
$conta = $conta;
}
extract($conta);
/*echo '<pre>';
print_r($_GET);
echo '</pre>';
*/
if ($_GET['img'] != '') {
$readonly = ' readonly="readonly"';
} else {
$readonly = '';
}
echo '<pre>';
print_r($readonly);
echo '</pre>';
} else
$labelBotao = 'Salvar';
$anoAtual = date('Y');
?>
<!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" />
<link type="text/css" href="<?= HOST;?>css/jquery-ui/ui.all.css" rel="Stylesheet" />
<!--[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" src="<?= HOST;?>includes/jquery.bestupper.min.js"></script>
<script type="text/javascript">
$(function(){
$('.dataPagamento').hide();
mostraModalidades();
<?if($CON_RowID != '') { ?>
$('#CON_TipoPagamento_DR').attr('disabled',true);
<?php } ?>
});
function verificaData(campo) {
if ($('#'+campo).val() != '') {
dataDg = $('#'+campo).val();
dts = dataDg.split('/');
dia = parseInt(dts[0]);
mes = parseInt(dts[1]);
ano = parseInt(dts[2]);
dia = dts[0];
mes = dts[1];
ano = dts[2];
//alert(dia+' - '+mes+' - '+ano);
if (parseInt(dia) > 31 || dia == 00 || typeof dia == 'undefined' ||
parseInt(mes) > 12 || mes == 00 || typeof mes == 'undefined' ||
parseInt(ano) > <?= ($anoAtual+1)?> || ano == 00 || typeof ano == 'undefined') {
alert('Data inválida');
$('#'+campo).val('');
$('#'+campo).focus();
return false;
} else {
return true;
}
}
}
/**
* 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 ($('#CON_DataPagamento'+f).val() == '') {
alert('Informe a data de pagamento!');
return false;
}
if(!validaDat('CON_DataPagamento',$('#CON_DataPagamento'+f).val()))
{
alert('Data de pagamento inválida!');
return false;
}
return true;
}
function validaForm() {
var pgto = $('#CON_TipoPagamento_DR').val().trim();
if ($('#CON_TipoPagamento_DR').val() == '') {
alert('Informe o tipo de pagamento!');
$('#CON_TipoPagamento_DR').focus();
return false;
}
if ($('#CON_Fornecedor_DR').val() == '') {
alert('Informe o Fornecedor!');
$('#CON_Fornecedor_DR').focus();
return false;
}
(pgto != 4)
{
if ($('#CON_DataVencimento').val() == '') {
alert('Digite a data de vencimento!');
$('#CON_DataVencimento').focus();
return false;
}
if (!verificaData('CON_DataVencimento')) {
alert('Data de Vencimento Inválida');
$('#CON_DataVencimento').focus();
return false;
}
}
if ($('#CON_Valor').val() == '' || $('#CON_Valor').val() == '0,00') {
alert('Digite um valor válido para pagamento!');
$('#CON_Valor').focus();
return false;
}
if (
($('#CON_ModDebito1').attr('checked')==false) &&
($('#CON_ModDebito2').attr('checked')==false) &&
($('#CON_ModDebito3').attr('checked')==false) &&
($('#CON_ModDebito4').attr('checked')==false) &&
($('#CON_ModDebito5').attr('checked')==false)
) {
alert('Selecione uma Modalidade de Débito!');
return false;
} else {
$('#salvar').attr('disabled',true);
$('#salvar').val('Aguarde...');
$('#form2').submit();
}
return false;
}
function alteraStatus(acao,id) {
if (acao == 'Inativar')
txt = 'inativação';
else
txt = 'ativação';
if (confirm('Confirma '+txt+' desta Conta?')) {
//alert(acao+' Fornecedor');
$('#result').load('conta_grava.php?id='+id+'&acao='+acao+'&chamou=<?= base64_encode($pgChamou)?>');
}
}
function mostraModalidades() {
var pgto = $('#CON_TipoPagamento_DR').val();
if(pgto==4) {
$('#modDeb1').css('display', 'none');
$('#modDeb2').css('display', 'block');
$('#modDeb3').css('display', 'none');
$('#modDeb4').css('display', 'block');
$('#modDeb5').css('display', 'block');
$('.dataPagamento').show();
$('.dataPreferencia').hide();
$('#CON_DataPrefPagamento').val('');
$('.exibe').hide();
} else
if(pgto==2) {
$('#modDeb1').css('display', 'none');
$('#modDeb2').css('display', 'block');
$('#modDeb3').css('display', 'block');
$('#modDeb4').css('display', 'block');
$('#modDeb5').css('display', 'none');
} else
if(pgto==3) {
$('#modDeb1').css('display', 'block');
$('#modDeb2').css('display', 'block');
$('#modDeb3').css('display', 'block');
$('#modDeb4').css('display', 'none');
$('#modDeb5').css('display', 'none');
$('.dataPagamento').hide();
$('.dataPreferencia').show();
$('.exibe').show();
}
}
</script>
<script type="text/javascript" src="<?= HOST;?>includes/priceFormat.js"></script>
<script type="text/javascript">
$(function() {
$('.bestupper').bestupper();
$('.bestlower').bestlower();
$('#CON_Valor').priceFormat({
limit: 9,
centsLimit: 2
});
if ($('#CON_Fornecedor_DR').val() != '')
carregaDados();
});
function carregaDados() {
$('#ddsFornecedor').html('Carregando...');
id = $('#CON_Fornecedor_DR').val().trim();
if(id != '')
{
$('#ddsFornecedor').load('conta_busca_dados_fornecedor.php?id='+id);
carregaGrupos();
}
else
{
$('#ddsFornecedor').html('');
}
}
function carregaGrupos() {
id = $('#CON_Fornecedor_DR').val();
$('#ddsGrupo').load('conta_carrega_grupos.php?id='+id+'&grupo=<?= $CON_Grupo_DR?>');
}
</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>Cadastro de Contas</h2>
<div id="linha_h2" align="center">
</div>
<form action="conta_grava.php" method="post" enctype="multipart/form-data" name="form2" id="form2" onsubmit="return validaForm()" target="recipiente">
<p>
<table width="80%" border="0" align="center" cellpadding="3" cellspacing="5" class="tabela">
<tr>
<td width="170" align="right">Referência / Cód. Barras:
<input name="CON_RowID" type="hidden" id="CON_RowID" value="<?= $CON_RowID?>" /><input type="hidden" name="tpAlt" id="tpAlt" value="<?= $_GET['img']?>" /><input type="hidden" name="chamou" id="chamou" value="<?= base64_encode($pgChamou)?>" /></td>
<td colspan="3"><input name="CON_Referencia" type="text" class="bestupper" id="CON_Referencia" value="<?= $CON_Referencia?>" size="35" <?= $readonly?> /></td>
</tr>
<tr>
<td align="right">Número do Cheque:</td>
<td colspan="3"><input name="CON_NumCheque" type="text" id="CON_NumCheque" size="35" value="<?= $CON_NumCheque?>" <?= $readonly?> /></td>
</tr>
<tr>
<td align="right">Número do Documento:</td>
<td colspan="3"><input name="CON_NumeroDocumento" type="text" id="CON_NumeroDocumento" size="35" <?= $readonly?> value="<?= $CON_NumeroDocumento?>" /></td>
</tr>
<tr>
<td align="right">Tipo do Pagamento<span style="color: #FF0066">*</span>:</td>
<td colspan="3"><select name="CON_TipoPagamento_DR" id="CON_TipoPagamento_DR" <?= $readonly?> onchange="mostraModalidades()">
<option value="">--- SELECIONE ---</option>
<?php
$where = 'PAG_AtivoSN = \'S\'';
$order = 'PAG_Nome ASC';
$contas = lista('FUN_TipoPagamento',$where,$order);
foreach ($contas as $conta) {
?>
<option value="<?= $conta['PAG_RowID']?>"
<?php
if ($conta['PAG_RowID'] == $CON_TipoPagamento_DR) {
echo ' selected="selected"';
}
?>
>
<?= utf8_decode($conta['PAG_Nome'])?>
</option>
<?php
}
?>
</select>
<?= ($CON_RowID != '') ? '<input type="hidden" name="CON_TipoPagamento_DR" value="'.$CON_TipoPagamento_DR.'" />' : ''?></td>
</tr>
<tr>
<td align="right">Fornecedor<span style="color: #FF0066">*</span>:</td>
<td colspan="3"><select name="CON_Fornecedor_DR" id="CON_Fornecedor_DR" <?= $readonly?> onchange="carregaDados(this.value);">
<option value="">--- SELECIONE ---</option>
<?php
$order = 'FOR_Nome ASC';
$where= "FOR_AtivoSN='S' ";
$fornecedores = lista('FUN_Fornecedores',$where,$order);
foreach ($fornecedores as $fornecedor) {
?>
<option value="<?= $fornecedor['FOR_RowID']?>"
<?php
if ($fornecedor['FOR_RowID'] == $CON_Fornecedor_DR) {
echo ' selected="selected"';
}
?>
>
<?= $fornecedor['FOR_Nome']?>
</option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td colspan="4">
<div id="ddsFornecedor">
</div>
</td>
</tr>
<tr>
<td align="right">Grupos:</td>
<td colspan="3">
<div id="ddsGrupo">
<select name="CON_Grupo_DR" id="CON_Grupo_DR">
<option value="">--- SELECIONE ---</option>
</select>
</div>
</td>
</tr>
<tr>
<td align="right">Histórico:</td>
<td colspan="3"><input name="CON_Historico" type="text" id="CON_Historico" value="<?= $CON_Historico?>" <?= $readonly?> class="bestupper" size="50" /></td>
</tr>
<tr>
<td align="right">Data Vencimento<span class="exibe" style="color: #FF0066">*</span>:</td>
<td colspan="3"><input name="CON_DataVencimento" type="text" id="CON_DataVencimento" onkeypress="return txtBoxFormat(this, '99/99/9999', event);" <?= $readonly?> value="<?= ($CON_DataVencimento != '') ? arrumaData($CON_DataVencimento,'mostra') : ''?>" onblur="return verificaData(this.id);" size="10" maxlength="10" /></td>
</tr>
<tr class="dataPreferencia" >
<td align="right" width="170">Data de Preferência para pagamento:</td>
<td colspan="3"><input name="CON_DataPrefPagamento" type="text" id="CON_DataPrefPagamento" onkeypress="return txtBoxFormat(this, '99/99/9999', event);" <?= $readonly?>
value="<?php
if(($CON_DataPrefPagamento != '') && ($CON_DataPrefPagamento != '0000-00-00')) {
echo arrumaData($CON_DataPrefPagamento,'mostra');
} else {
echo '';
}
?>" onblur="return verificaData(this.id);" size="10" maxlength="10" /></td>
</tr>
<tr class="dataPagamento">
<td align="right" width="170">Data de Pagamento:</td>
<td colspan="3">
<input name="CON_DataPagamento" type="text" id="CON_DataPagamento" onkeypress="return txtBoxFormat(this, '99/99/9999', event);" <?= $readonly?>
value="<?php
if(($CON_DataPagamento != '') && ($CON_DataPagamento != '0000-00-00')) {
echo arrumaData($CON_DataPagamento,'mostra');
} else {
echo date('d/m/Y');
}
?>" onblur="return verificaData(this.id);" size="10" maxlength="10" />
</td>
</tr>
<tr>
<td align="right">Valor<span style="color: #FF0066">*</span>:</td>
<td colspan="3"><input name="CON_Valor" type="text" id="CON_Valor" size="10" value="<?= ($CON_Valor != '') ? number_format($CON_Valor,2,',','') : ''?>" <?= $readonly?> /></td>
</tr>
<tr>
<td align="right">Imagem Documento:</td>
<td colspan="3"><input type="file" name="CON_ImgDoc" id="CON_ImgDoc" />
</td>
</tr>
<tr>
<td align="right">Modalidade de Débito<span style="color: #FF0066">*</span>:</td>
<td colspan="3">
<div id="modDeb1" style="display: none;">
<input type="radio" name="CON_ModDebito" id="CON_ModDebito1" value="1" <?= ($CON_ModDebito==1)?"checked=\"checked\"":""?> />
<label for="CON_ModDebito1">Autorização de Retirada</label>
</div>
<div id="modDeb2" style="display: none;">
<input type="radio" name="CON_ModDebito" id="CON_ModDebito2" value="2" <?= ($CON_ModDebito==2)?"checked=\"checked\"":""?> />
<label for="CON_ModDebito2">Pagamento de Boleto Bancário</label>
</div>
<div id="modDeb3" style="display: none;">
<input type="radio" name="CON_ModDebito" id="CON_ModDebito3" value="3" <?= ($CON_ModDebito==3)?"checked=\"checked\"":""?> />
<label for="CON_ModDebito3">Transferência Bancária</label>
</div>
<div id="modDeb4" style="display: none;">
<input type="radio" name="CON_ModDebito" id="CON_ModDebito4" value="4" <?= ($CON_ModDebito==4)?"checked=\"checked\"":""?> />
<label for="CON_ModDebito4">Cheque</label>
</div>
<div id="modDeb5" style="display: none;">
<input type="radio" name="CON_ModDebito" id="CON_ModDebito5" value="5" <?= ($CON_ModDebito==5)?"checked=\"checked\"":""?> />
<label for="CON_ModDebito5">Depósito Bancário</label>
</div>
</td>
</tr>
</table>
<p> </p>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<!--?php if ($_GET['img'] == '') { ?-->
<input type="submit" name="salvar" id="salvar" <?= $readonly?> value="<?= $labelBotao?>"/>
<!--?php } ?-->
<input type="button" name="voltar" id="voltar" value="Voltar" onclick="history.go(-1)" /></td>
</tr>
</table>
</p>
</form>
<iframe name="recipiente" id="recipiente" width="0" height="0"></iframe>
</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>
</div>
<div id="result"></div>
</body>
</html>
|